mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-13 22:32:04 +00:00
test(browser): leave no state behind for the next case
Await the form's explicit unmount: an unmount left running overlaps the next render's act, and React then commits nothing for the rest of the file. Return to the newest history entry after stepping back, so the next case's push adds an entry instead of replacing the forward one.
This commit is contained in:
1 parent
54d0647a6d
commit
4f7802ba28
2 files changed
+9
-1
No files matched your search
@@ -289,7 +289,10 @@ describe("<MeasurementForm> type", () => {
|
||||
await first.screen.getByLabelText("Value (kg)").fill("80");
|
||||
await first.save.click();
|
||||
await expect.poll(() => first.onSuccess.mock.calls.length).toBe(1);
|
||||
first.screen.unmount();
|
||||
// Awaited: the unmount runs inside `act`, and one left running overlaps
|
||||
// the next render's `act`, after which React commits nothing for the
|
||||
// rest of the file (every later case finds an empty container).
|
||||
await first.screen.unmount();
|
||||
|
||||
const { screen } = await mount();
|
||||
await expect
|
||||
|
||||
Reference in new issue
Block a user