Skip to content

Commit 048ee4c

Browse files
authored
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.
1 parent 556644e commit 048ee4c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/react-reconciler/src/__tests__/ReactIncrementalTriangle-test.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,9 @@ describe('ReactIncrementalTriangle', () => {
432432
assertConsistentTree(activeLeafIndices);
433433
}
434434
// Flush remaining work
435-
Scheduler.unstable_flushAllWithoutAsserting();
435+
ReactNoop.act(() => {
436+
Scheduler.unstable_flushAllWithoutAsserting();
437+
});
436438
assertConsistentTree(activeLeafIndices, expectedCounterAtEnd);
437439
}
438440

@@ -562,6 +564,12 @@ ${formatActions(actions)}
562564
['b', flush(7)],
563565
['c', toggle(0)],
564566
);
567+
568+
simulateMultipleRoots(
569+
['c', step(1)],
570+
['c', expire(5000)],
571+
['b', toggle(1)],
572+
);
565573
});
566574

567575
it('generative tests', () => {

0 commit comments

Comments
 (0)