Skip to content

Commit

Permalink
Use timers instead of act to force fallbacks to show
Browse files Browse the repository at this point in the history
  • Loading branch information
sebmarkbage committed Dec 1, 2020
1 parent 76d4a7d commit 9fb5014
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1344,10 +1344,9 @@ describe('ReactLazy', () => {
expect(root).toMatchRenderedOutput('AB');

// Swap the position of A and B
ReactTestRenderer.act(() => {
root.update(<Parent swap={true} />);
expect(Scheduler).toFlushAndYield(['Init B2', 'Loading...']);
});
root.update(<Parent swap={true} />);
expect(Scheduler).toFlushAndYield(['Init B2', 'Loading...']);
jest.runAllTimers();

// The suspense boundary should've triggered now.
expect(root).toMatchRenderedOutput('Loading...');
Expand Down

0 comments on commit 9fb5014

Please sign in to comment.