Skip to content

Commit

Permalink
Use act in fuzz tester to flush expired work (facebook#21108)
Browse files Browse the repository at this point in the history
* Add failing hard-coded fuzz test

Caught in CI by the fuzz tester.

Related to expired updates.

* Use `act` in fuzz tester to flush expired work

Expired work gets scheduled in a microtask now, so we need to use `act`
to flush it.
  • Loading branch information
acdlite committed Apr 19, 2021
1 parent 3cd24c3 commit a4312fa
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,9 @@ describe('ReactIncrementalTriangle', () => {
assertConsistentTree(activeLeafIndices);
}
// Flush remaining work
Scheduler.unstable_flushAllWithoutAsserting();
ReactNoop.act(() => {
Scheduler.unstable_flushAllWithoutAsserting();
});
assertConsistentTree(activeLeafIndices, expectedCounterAtEnd);
}

Expand Down Expand Up @@ -562,6 +564,12 @@ ${formatActions(actions)}
['b', flush(7)],
['c', toggle(0)],
);

simulateMultipleRoots(
['c', step(1)],
['c', expire(5000)],
['b', toggle(1)],
);
});

it('generative tests', () => {
Expand Down

0 comments on commit a4312fa

Please sign in to comment.