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 11, 2021
1 parent f797681 commit b8cfa81
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 b8cfa81

Please sign in to comment.