Skip to content

Commit 43360d9

Browse files
committed
Add expiration to fuzz tester
1 parent 240fb97 commit 43360d9

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/renderers/shared/fiber/__tests__/ReactIncrementalTriangle-test.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ describe('ReactIncrementalTriangle', () => {
6060
};
6161
}
6262

63+
const EXPIRE = 'EXPIRE';
64+
function expire(ms) {
65+
return {
66+
type: EXPIRE,
67+
ms,
68+
};
69+
}
70+
6371
function TriangleSimulator() {
6472
let triangles = [];
6573
let leafTriangles = [];
@@ -218,6 +226,9 @@ describe('ReactIncrementalTriangle', () => {
218226
targetTriangle.activate();
219227
}
220228
break;
229+
case EXPIRE:
230+
ReactNoop.expire(action.ms);
231+
break;
221232
default:
222233
break;
223234
}
@@ -257,7 +268,7 @@ describe('ReactIncrementalTriangle', () => {
257268
}
258269

259270
function randomAction() {
260-
switch (randomInteger(0, 4)) {
271+
switch (randomInteger(0, 5)) {
261272
case 0:
262273
return flush(randomInteger(0, totalTriangles * 1.5));
263274
case 1:
@@ -266,6 +277,8 @@ describe('ReactIncrementalTriangle', () => {
266277
return interrupt();
267278
case 3:
268279
return toggle(randomInteger(0, totalChildren));
280+
case 4:
281+
return expire(randomInteger(0, 1500));
269282
default:
270283
throw new Error('Switch statement should be exhaustive');
271284
}
@@ -296,6 +309,9 @@ describe('ReactIncrementalTriangle', () => {
296309
case TOGGLE:
297310
result += `toggle(${action.childIndex})`;
298311
break;
312+
case EXPIRE:
313+
result += `expire(${action.ms})`;
314+
break;
299315
default:
300316
throw new Error('Switch statement should be exhaustive');
301317
}

0 commit comments

Comments
 (0)