Skip to content

Commit 556ddbf

Browse files
committed
Fix test
1 parent 2cc839e commit 556ddbf

File tree

1 file changed

+21
-44
lines changed

1 file changed

+21
-44
lines changed

packages/react-reconciler/src/__tests__/ReactIncrementalUpdates-test.js

Lines changed: 21 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -162,17 +162,11 @@ describe('ReactIncrementalUpdates', () => {
162162
}
163163

164164
// Schedule some async updates
165-
if (gate(flags => flags.enableSyncDefaultUpdates)) {
166-
React.startTransition(() => {
167-
instance.setState(createUpdate('a'));
168-
instance.setState(createUpdate('b'));
169-
instance.setState(createUpdate('c'));
170-
});
171-
} else {
165+
React.startTransition(() => {
172166
instance.setState(createUpdate('a'));
173167
instance.setState(createUpdate('b'));
174168
instance.setState(createUpdate('c'));
175-
}
169+
});
176170

177171
// Begin the updates but don't flush them yet
178172
expect(Scheduler).toFlushAndYieldThrough(['a', 'b', 'c']);
@@ -189,14 +183,8 @@ describe('ReactIncrementalUpdates', () => {
189183
});
190184

191185
// The sync updates should have flushed, but not the async ones.
192-
if (gate(flags => flags.enableSyncDefaultUpdates)) {
193-
expect(Scheduler).toHaveYielded(['d', 'e', 'f']);
194-
expect(ReactNoop.getChildren()).toEqual([span('def')]);
195-
} else {
196-
// Update d was dropped and replaced by e.
197-
expect(Scheduler).toHaveYielded(['e', 'f']);
198-
expect(ReactNoop.getChildren()).toEqual([span('ef')]);
199-
}
186+
expect(Scheduler).toHaveYielded(['d', 'e', 'f']);
187+
expect(ReactNoop.getChildren()).toEqual([span('def')]);
200188

201189
// Now flush the remaining work. Even though e and f were already processed,
202190
// they should be processed again, to ensure that the terminal state
@@ -245,17 +233,11 @@ describe('ReactIncrementalUpdates', () => {
245233
}
246234

247235
// Schedule some async updates
248-
if (gate(flags => flags.enableSyncDefaultUpdates)) {
249-
React.startTransition(() => {
250-
instance.setState(createUpdate('a'));
251-
instance.setState(createUpdate('b'));
252-
instance.setState(createUpdate('c'));
253-
});
254-
} else {
236+
React.startTransition(() => {
255237
instance.setState(createUpdate('a'));
256238
instance.setState(createUpdate('b'));
257239
instance.setState(createUpdate('c'));
258-
}
240+
});
259241

260242
// Begin the updates but don't flush them yet
261243
expect(Scheduler).toFlushAndYieldThrough(['a', 'b', 'c']);
@@ -275,18 +257,22 @@ describe('ReactIncrementalUpdates', () => {
275257
});
276258

277259
// The sync updates should have flushed, but not the async ones.
278-
if (gate(flags => flags.enableSyncDefaultUpdates)) {
279-
expect(Scheduler).toHaveYielded(['d', 'e', 'f']);
280-
} else {
281-
// Update d was dropped and replaced by e.
282-
expect(Scheduler).toHaveYielded(['e', 'f']);
283-
}
260+
expect(Scheduler).toHaveYielded(['d', 'e', 'f']);
284261
expect(ReactNoop.getChildren()).toEqual([span('f')]);
285262

286263
// Now flush the remaining work. Even though e and f were already processed,
287264
// they should be processed again, to ensure that the terminal state
288265
// is deterministic.
289-
expect(Scheduler).toFlushAndYield(['a', 'b', 'c', 'd', 'e', 'f', 'g']);
266+
expect(Scheduler).toFlushAndYield([
267+
// Then we'll re-process everything for 'g'.
268+
'a',
269+
'b',
270+
'c',
271+
'd',
272+
'e',
273+
'f',
274+
'g',
275+
]);
290276
expect(ReactNoop.getChildren()).toEqual([span('fg')]);
291277
});
292278

@@ -629,14 +615,9 @@ describe('ReactIncrementalUpdates', () => {
629615
expect(root).toMatchRenderedOutput(null);
630616

631617
await act(async () => {
632-
if (gate(flags => flags.enableSyncDefaultUpdates)) {
633-
React.startTransition(() => {
634-
pushToLog('A');
635-
});
636-
} else {
618+
React.startTransition(() => {
637619
pushToLog('A');
638-
}
639-
620+
});
640621
ReactNoop.unstable_runWithPriority(ContinuousEventPriority, () =>
641622
pushToLog('B'),
642623
);
@@ -688,13 +669,9 @@ describe('ReactIncrementalUpdates', () => {
688669
expect(root).toMatchRenderedOutput(null);
689670

690671
await act(async () => {
691-
if (gate(flags => flags.enableSyncDefaultUpdates)) {
692-
React.startTransition(() => {
693-
pushToLog('A');
694-
});
695-
} else {
672+
React.startTransition(() => {
696673
pushToLog('A');
697-
}
674+
});
698675
ReactNoop.unstable_runWithPriority(ContinuousEventPriority, () =>
699676
pushToLog('B'),
700677
);

0 commit comments

Comments
 (0)