Skip to content

Commit 43f4cc1

Browse files
authored
Fix failing test (#21697)
1 parent d0f348d commit 43f4cc1

File tree

1 file changed

+10
-19
lines changed

1 file changed

+10
-19
lines changed

packages/react-reconciler/src/__tests__/ReactSuspense-test.internal.js

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -695,28 +695,19 @@ describe('ReactSuspense', () => {
695695
expect(Scheduler).toFlushAndYield(['Child 1', 'create layout']);
696696
expect(root).toMatchRenderedOutput('Child 1');
697697

698-
ReactTestRenderer.act(() => {
698+
act(() => {
699699
_setShow(true);
700700
});
701-
expect(Scheduler).toHaveYielded(
702-
// DEV behavior differs from prod
703-
// In DEV sometimes the work loop sync-flushes the commit
704-
// where as in production, it schedules it behind a timeout.
705-
// See shouldForceFlushFallbacksInDEV() usage
706-
__DEV__
707-
? ['Child 1', 'Suspend! [Child 2]', 'Loading...', 'destroy layout']
708-
: ['Child 1', 'Suspend! [Child 2]', 'Loading...'],
709-
);
701+
expect(Scheduler).toHaveYielded([
702+
'Child 1',
703+
'Suspend! [Child 2]',
704+
'Loading...',
705+
]);
710706
jest.advanceTimersByTime(1000);
711-
expect(Scheduler).toHaveYielded(
712-
// DEV behavior differs from prod
713-
// In DEV sometimes the work loop sync-flushes the commit
714-
// where as in production, it schedules it behind a timeout.
715-
// See shouldForceFlushFallbacksInDEV() usage
716-
__DEV__
717-
? ['Promise resolved [Child 2]']
718-
: ['destroy layout', 'Promise resolved [Child 2]'],
719-
);
707+
expect(Scheduler).toHaveYielded([
708+
'destroy layout',
709+
'Promise resolved [Child 2]',
710+
]);
720711
expect(Scheduler).toFlushAndYield(['Child 1', 'Child 2', 'create layout']);
721712
expect(root).toMatchRenderedOutput(['Child 1', 'Child 2'].join(''));
722713
});

0 commit comments

Comments
 (0)