Skip to content

Commit

Permalink
Add expiration to fuzz tester
Browse files Browse the repository at this point in the history
  • Loading branch information
acdlite committed Sep 14, 2017
1 parent 5019a90 commit 36244ac
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ describe('ReactIncrementalTriangle', () => {
};
}

const EXPIRE = 'EXPIRE';
function expire(ms) {
return {
type: EXPIRE,
ms,
};
}

function TriangleSimulator() {
let triangles = [];
let leafTriangles = [];
Expand Down Expand Up @@ -214,6 +222,9 @@ describe('ReactIncrementalTriangle', () => {
targetTriangle.activate();
}
break;
case EXPIRE:
ReactNoop.expire(action.ms);
break;
default:
break;
}
Expand Down Expand Up @@ -253,7 +264,7 @@ describe('ReactIncrementalTriangle', () => {
}

function randomAction() {
switch (randomInteger(0, 4)) {
switch (randomInteger(0, 5)) {
case 0:
return flush(randomInteger(0, totalTriangles * 1.5));
case 1:
Expand All @@ -262,6 +273,8 @@ describe('ReactIncrementalTriangle', () => {
return interrupt();
case 3:
return toggle(randomInteger(0, totalChildren));
case 4:
return expire(randomInteger(0, 1500));
default:
throw new Error('Switch statement should be exhaustive');
}
Expand Down Expand Up @@ -292,6 +305,9 @@ describe('ReactIncrementalTriangle', () => {
case TOGGLE:
result += `toggle(${action.childIndex})`;
break;
case EXPIRE:
result += `expire(${action.ms})`;
break;
default:
throw new Error('Switch statement should be exhaustive');
}
Expand Down

0 comments on commit 36244ac

Please sign in to comment.