Use `act` in fuzz tester to flush expired work (#21108)
* 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.
Andrew Clark committed
Mar 25, 2021 at 22:08 UTC
048ee4c0cd3ee766d041c86029ca7cf2b874bfe0
1 file changed
+9
-1
packages/react-reconciler/src/__tests__/ReactIncrementalTriangle-test.js
+9
-1
@@ -432,7 +432,9 @@ describe('ReactIncrementalTriangle', () => {
432
assertConsistentTree(activeLeafIndices);
433
}
434
// Flush remaining work
435
- Scheduler.unstable_flushAllWithoutAsserting();
435
+ ReactNoop.act(() => {
436
+ Scheduler.unstable_flushAllWithoutAsserting();
437
+ });
438
assertConsistentTree(activeLeafIndices, expectedCounterAtEnd);
439
}
440
@@ -562,6 +564,12 @@ ${formatActions(actions)}
564
['b', flush(7)],
565
['c', toggle(0)],
566
);
567
+
568
+ simulateMultipleRoots(
569
+ ['c', step(1)],
570
+ ['c', expire(5000)],
571
+ ['b', toggle(1)],
572
+ );
573
});
574
575
it('generative tests', () => {