Skip to content

.debounce doesn't seem to work as expected #920

Answered by mbrandonw
jacobbullock asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @jacobbullock, I believe this is just due to the imprecision of using test expectations for waiting exact amounts of time. The reducer is debouncing for 1 second and we are telling the test suite to wait 1 second so that the effect can get past the debounce. It seems that at the time of recording that episode that worked fine, but now the test suite needs a little more time to wait.

If you change the expectation to wait just a bit longer, like say 1.01 seconds:

XCTWaiter.wait(for:[self.expectation(description: "wait")], timeout: 1.01)

Then the test suite will pass.

This all goes to show how imprecise using live schedulers in TCA tests can be, which is why we highly recommend using a te…

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@iampatbrown
Comment options

@jacobbullock
Comment options

@iampatbrown
Comment options

@mbrandonw
Comment options

@jacobbullock
Comment options

Answer selected by jacobbullock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #919 on December 15, 2021 13:46.