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.
This commit is contained in:
Andrew Clark
2021-03-25 20:08:53 -07:00
committed by GitHub
parent 556644e237
commit 048ee4c0cd
@@ -432,7 +432,9 @@ describe('ReactIncrementalTriangle', () => {
assertConsistentTree(activeLeafIndices);
}
// Flush remaining work
Scheduler.unstable_flushAllWithoutAsserting();
ReactNoop.act(() => {
Scheduler.unstable_flushAllWithoutAsserting();
});
assertConsistentTree(activeLeafIndices, expectedCounterAtEnd);
}
@@ -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', () => {