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 29, 2017
1 parent 0e1c3d2 commit 03c3618
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ describe('ReactIncrementalTriangle', () => {
};
}

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

function TriangleSimulator() {
let triangles = [];
let leafTriangles = [];
Expand Down Expand Up @@ -212,6 +220,9 @@ describe('ReactIncrementalTriangle', () => {
targetTriangle.activate();
}
break;
case EXPIRE:
ReactNoop.expire(action.ms);
break;
default:
break;
}
Expand Down Expand Up @@ -251,7 +262,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 @@ -260,6 +271,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 @@ -290,6 +303,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 03c3618

Please sign in to comment.