mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Codemod tests to waitFor pattern (2/?) (#26296)
This converts some of our test suite to use the `waitFor` test pattern, instead of the `expect(Scheduler).toFlushAndYield` pattern. Most of these changes are automated with jscodeshift, with some slight manual cleanup in certain cases. See #26285 for full context.
This commit is contained in:
+5
-1
@@ -19,6 +19,7 @@ describe('React hooks DevTools integration', () => {
|
||||
let overrideHookState;
|
||||
let scheduleUpdate;
|
||||
let setSuspenseHandler;
|
||||
let waitForAll;
|
||||
|
||||
global.IS_REACT_ACT_ENVIRONMENT = true;
|
||||
|
||||
@@ -41,6 +42,9 @@ describe('React hooks DevTools integration', () => {
|
||||
ReactTestRenderer = require('react-test-renderer');
|
||||
Scheduler = require('scheduler');
|
||||
|
||||
const InternalTestUtils = require('internal-test-utils');
|
||||
waitForAll = InternalTestUtils.waitForAll;
|
||||
|
||||
act = ReactTestRenderer.act;
|
||||
});
|
||||
|
||||
@@ -256,7 +260,7 @@ describe('React hooks DevTools integration', () => {
|
||||
),
|
||||
);
|
||||
|
||||
expect(Scheduler).toFlushAndYield([]);
|
||||
await waitForAll([]);
|
||||
// Ensure we timeout any suspense time.
|
||||
jest.advanceTimersByTime(1000);
|
||||
const fiber = renderer.root._currentFiber().child;
|
||||
|
||||
Reference in New Issue
Block a user