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 Aug 17, 2017
1 parent 240fb97 commit 43360d9
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ describe('ReactIncrementalTriangle', () => {
};
}

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

function TriangleSimulator() {
let triangles = [];
let leafTriangles = [];
Expand Down Expand Up @@ -218,6 +226,9 @@ describe('ReactIncrementalTriangle', () => {
targetTriangle.activate();
}
break;
case EXPIRE:
ReactNoop.expire(action.ms);
break;
default:
break;
}
Expand Down Expand Up @@ -257,7 +268,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 @@ -266,6 +277,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 @@ -296,6 +309,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 43360d9

Please sign in to comment.