Skip to content

Exception for [no-wait-for-multiple-assertions] rule #595

Closed Answered by Belco90
SevenOutman asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @SevenOutman!

I'm afraid that I don't see how we could add an exception to that.

First, this rule makes sense for your use case too, since when the first error message appears, the second one should be there too, so you only need to await for one of them. This is on the same page as the scenario explained in the Common mistakes with React Testing Library post, so your test fails faster. In general, the waitFor util should look like this in your tests:

  1. side-effects triggering async behaviors
  2. waitFor for the very first assertion related to the async behavior
  3. all the remaining assertions related to the async behavior

I guess your point is about asserting a mock is called once and is cal…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@SevenOutman
Comment options

@Belco90
Comment options

@SevenOutman
Comment options

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