Insure assertions execute on the same rendered state #902
|
I'm experiencing an issue with the way bUnit behaves when a test contains multiple assertion statements, is there any way to ensure that all assertion statements in a test are run on the same rendered state, ie. no rerenders can occur between the assertion statements? As an example I have this test: This test has failed with the following exception on the last line: As far as I can tell this can only occur if the state of |
Replies: 2 comments 2 replies
|
Hi @Jan-IT-Minds, Take a look at https://bunit.dev/docs/verification/async-assertion.html. You basically want to wrap your assertions in a |
|
Thanks for your quick response @egil. Maybe I should have expanded more on my inquiry, I had already considered that but found it to be insufficient since the nature of the issue is that I can't be certain that all the assertions I'm making are true at the same time if the state of what I'm asserting against can change between my assertion statements. Using If a rerender occurs between the first and second assertion this test would pass. Putting the assertions in a Is there some way to await the rerendering to stop? |
Hi @Jan-IT-Minds,
Take a look at https://bunit.dev/docs/verification/async-assertion.html. You basically want to wrap your assertions in a
cut.WaitForAssertion(() => { ... assertions goes here });