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 16, 2021
1 parent 9283b83 commit c83063f
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 c83063f

Please sign in to comment.