Skip to content

Commit 36244ac

Browse files
committed
Add expiration to fuzz tester
1 parent 5019a90 commit 36244ac

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
@@ -56,6 +56,14 @@ describe('ReactIncrementalTriangle', () => {
5656
};
5757
}
5858

59+
const EXPIRE = 'EXPIRE';
60+
function expire(ms) {
61+
return {
62+
type: EXPIRE,
63+
ms,
64+
};
65+
}
66+
5967
function TriangleSimulator() {
6068
let triangles = [];
6169
let leafTriangles = [];
@@ -214,6 +222,9 @@ describe('ReactIncrementalTriangle', () => {
214222
targetTriangle.activate();
215223
}
216224
break;
225+
case EXPIRE:
226+
ReactNoop.expire(action.ms);
227+
break;
217228
default:
218229
break;
219230
}
@@ -253,7 +264,7 @@ describe('ReactIncrementalTriangle', () => {
253264
}
254265

255266
function randomAction() {
256-
switch (randomInteger(0, 4)) {
267+
switch (randomInteger(0, 5)) {
257268
case 0:
258269
return flush(randomInteger(0, totalTriangles * 1.5));
259270
case 1:
@@ -262,6 +273,8 @@ describe('ReactIncrementalTriangle', () => {
262273
return interrupt();
263274
case 3:
264275
return toggle(randomInteger(0, totalChildren));
276+
case 4:
277+
return expire(randomInteger(0, 1500));
265278
default:
266279
throw new Error('Switch statement should be exhaustive');
267280
}
@@ -292,6 +305,9 @@ describe('ReactIncrementalTriangle', () => {
292305
case TOGGLE:
293306
result += `toggle(${action.childIndex})`;
294307
break;
308+
case EXPIRE:
309+
result += `expire(${action.ms})`;
310+
break;
295311
default:
296312
throw new Error('Switch statement should be exhaustive');
297313
}

0 commit comments

Comments
 (0)