From 497b2f6326e57ef8acc4ddfd71b109037873e17f Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Tue, 4 Feb 2020 17:14:21 +0000 Subject: [PATCH] Fix tests --- ...tSuspenseWithNoopRenderer-test.internal.js | 42 ++++++++----------- 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.internal.js b/packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.internal.js index 361d8c1467090..9fbedd488ab8e 100644 --- a/packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.internal.js +++ b/packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.internal.js @@ -1867,7 +1867,8 @@ describe('ReactSuspenseWithNoopRenderer', () => { expect(ReactNoop.getChildren()).toEqual([span('Loading...')]); }); - it('warns when a low priority update suspends inside a high priority update for functional components', async () => { + // TODO: flip to "warns" when this is implemented again. + it('does not warn when a low priority update suspends inside a high priority update for functional components', async () => { let _setShow; function App() { let [show, setShow] = React.useState(false); @@ -1883,20 +1884,17 @@ describe('ReactSuspenseWithNoopRenderer', () => { ReactNoop.render(); }); - expect(() => { - ReactNoop.act(() => { - Scheduler.unstable_runWithPriority( - Scheduler.unstable_UserBlockingPriority, - () => _setShow(true), - ); - }); - }).toErrorDev( - 'Warning: App triggered a user-blocking update that suspended.' + '\n\n', - {withoutStack: true}, - ); + // TODO: assert toErrorDev() when the warning is implemented again. + ReactNoop.act(() => { + Scheduler.unstable_runWithPriority( + Scheduler.unstable_UserBlockingPriority, + () => _setShow(true), + ); + }); }); - it('warns when a low priority update suspends inside a high priority update for class components', async () => { + // TODO: flip to "warns" when this is implemented again. + it('does not warn when a low priority update suspends inside a high priority update for class components', async () => { let show; class App extends React.Component { state = {show: false}; @@ -1915,17 +1913,13 @@ describe('ReactSuspenseWithNoopRenderer', () => { ReactNoop.render(); }); - expect(() => { - ReactNoop.act(() => { - Scheduler.unstable_runWithPriority( - Scheduler.unstable_UserBlockingPriority, - () => show(), - ); - }); - }).toErrorDev( - 'Warning: App triggered a user-blocking update that suspended.' + '\n\n', - {withoutStack: true}, - ); + // TODO: assert toErrorDev() when the warning is implemented again. + ReactNoop.act(() => { + Scheduler.unstable_runWithPriority( + Scheduler.unstable_UserBlockingPriority, + () => show(), + ); + }); }); it('does not warn about wrong Suspense priority if no new fallbacks are shown', async () => {