Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rickhanlonii committed May 31, 2023
1 parent f708808 commit d3bc7a2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
28 changes: 14 additions & 14 deletions packages/react-reconciler/src/__tests__/ReactExpiration-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,20 +127,20 @@ describe('ReactExpiration', () => {
it('increases priority of updates as time progresses', async () => {
if (gate(flags => flags.forceConcurrentByDefaultForTesting)) {
// TODO: How does this pass on main?
// ReactNoop.render(<span prop="done" />);
// expect(ReactNoop).toMatchRenderedOutput(null);
//
// // Nothing has expired yet because time hasn't advanced.
// flushNextRenderIfExpired();
// expect(ReactNoop).toMatchRenderedOutput(null);
// // Advance time a bit, but not enough to expire the low pri update.
// ReactNoop.expire(4500);
// flushNextRenderIfExpired();
// expect(ReactNoop).toMatchRenderedOutput(null);
// // Advance by another second. Now the update should expire and flush.
// ReactNoop.expire(500);
// flushNextRenderIfExpired();
// expect(ReactNoop).toMatchRenderedOutput(<span prop="done" />);
ReactNoop.render(<span prop="done" />);
expect(ReactNoop).toMatchRenderedOutput(null);

// Nothing has expired yet because time hasn't advanced.
flushNextRenderIfExpired();
expect(ReactNoop).toMatchRenderedOutput(null);
// Advance time a bit, but not enough to expire the low pri update.
ReactNoop.expire(4500);
flushNextRenderIfExpired();
expect(ReactNoop).toMatchRenderedOutput(null);
// Advance by another second. Now the update should expire and flush.
ReactNoop.expire(500);
flushNextRenderIfExpired();
expect(ReactNoop).toMatchRenderedOutput(<span prop="done" />);
} else {
ReactNoop.render(<Text text="Step 1" />);
React.startTransition(() => {
Expand Down
2 changes: 1 addition & 1 deletion scripts/jest/setupTests.www.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jest.mock('shared/ReactFeatureFlags', () => {
const actual = jest.requireActual('shared/forks/ReactFeatureFlags.www');

// This flag is only used by tests, it should never be set elsewhere.
actual.forceConcurrentByDefaultForTesting = __VARIANT__;
actual.forceConcurrentByDefaultForTesting = !__VARIANT__;

return actual;
});
Expand Down

0 comments on commit d3bc7a2

Please sign in to comment.