Skip to content

Commit 5cc755c

Browse files
committed
Update test comments with explanations
1 parent bfa50f8 commit 5cc755c

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ describe('ReactHooksWithNoopRenderer', () => {
166166
// Schedule some updates
167167
if (gate(flags => flags.enableSyncDefaultUpdates)) {
168168
React.startTransition(() => {
169-
// TODO: Batched updates need to be inside startTransition?
170169
ReactNoop.batchedUpdates(() => {
171170
counter.current.updateCount(1);
172171
counter.current.updateCount(count => count + 10);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,12 +287,12 @@ describe('ReactIncrementalScheduling', () => {
287287
instance.setState({tick: 2});
288288
});
289289

290-
// TODO: why does this flush sync?
291290
expect(Scheduler).toFlushAndYieldThrough([
292291
'render: 2',
293292
'componentDidUpdate: 2',
294293
'componentDidUpdate (before setState): 2',
295294
'componentDidUpdate (after setState): 2',
295+
// This renders because the scheduled update is default, which is sync.
296296
'render: 3',
297297
'componentDidUpdate: 3',
298298
]);

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,13 @@ describe('ReactIncrementalUpdates', () => {
196196
// Now flush the remaining work. Even though e and f were already processed,
197197
// they should be processed again, to ensure that the terminal state
198198
// is deterministic.
199-
// TODO: should d, e, f be flushed again first?
200199
expect(Scheduler).toFlushAndYield([
200+
// Since 'g' is in a transition, we'll process 'd' separately first.
201+
// That causes us to process 'd' with 'e' and 'f' rebased.
201202
'd',
202203
'e',
203204
'f',
205+
// Then we'll re-process everything for 'g'.
204206
'a',
205207
'b',
206208
'c',
@@ -290,18 +292,19 @@ describe('ReactIncrementalUpdates', () => {
290292
});
291293

292294
// The sync updates should have flushed, but not the async ones.
293-
// TODO: should 'd' have flushed?
294-
// TODO: should 'f' have flushed? I don't know what enqueueReplaceState is.
295295
expect(Scheduler).toHaveYielded(['e', 'f']);
296296
expect(ReactNoop.getChildren()).toEqual([span('f')]);
297297

298298
// Now flush the remaining work. Even though e and f were already processed,
299299
// they should be processed again, to ensure that the terminal state
300300
// is deterministic.
301301
expect(Scheduler).toFlushAndYield([
302+
// Since 'g' is in a transition, we'll process 'd' separately first.
303+
// That causes us to process 'd' with 'e' and 'f' rebased.
302304
'd',
303305
'e',
304306
'f',
307+
// Then we'll re-process everything for 'g'.
305308
'a',
306309
'b',
307310
'c',

0 commit comments

Comments
 (0)