Skip to content

Commit

Permalink
Call Scheduler.flushAll unconditionally in tests
Browse files Browse the repository at this point in the history
Instead of wrapping in enableNewScheduler flag.
  • Loading branch information
acdlite committed Apr 2, 2019
1 parent be3bec7 commit f1dc626
Showing 1 changed file with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ let ReactTestRenderer;
let Scheduler;
let ReactDOMServer;
let act;
let enableNewScheduler;

// Additional tests can be found in ReactHooksWithNoopRenderer. Plan is to
// gradually migrate those to this file.
Expand All @@ -33,7 +32,6 @@ describe('ReactHooks', () => {
Scheduler = require('scheduler');
ReactDOMServer = require('react-dom/server');
act = ReactTestRenderer.act;
enableNewScheduler = ReactFeatureFlags.enableNewScheduler;
});

if (__DEV__) {
Expand Down Expand Up @@ -1749,9 +1747,7 @@ describe('ReactHooks', () => {
);
expect(root).toMatchRenderedOutput('loading');
await Promise.resolve();
if (enableNewScheduler) {
Scheduler.flushAll();
}
Scheduler.flushAll();
expect(root).toMatchRenderedOutput('hello');
});

Expand Down Expand Up @@ -1783,9 +1779,7 @@ describe('ReactHooks', () => {
);
expect(root).toMatchRenderedOutput('loading');
await Promise.resolve();
if (enableNewScheduler) {
Scheduler.flushAll();
}
Scheduler.flushAll();
expect(root).toMatchRenderedOutput('hello');
});

Expand Down Expand Up @@ -1817,9 +1811,7 @@ describe('ReactHooks', () => {
);
expect(root).toMatchRenderedOutput('loading');
await Promise.resolve();
if (enableNewScheduler) {
Scheduler.flushAll();
}
Scheduler.flushAll();
expect(root).toMatchRenderedOutput('hello');
});
});

0 comments on commit f1dc626

Please sign in to comment.