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 Oct 5, 2017
1 parent 320d71d commit 564c7e9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/renderers/shared/fiber/ReactFiberBeginWork.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@ module.exports = function<T, P, I, TI, PI, C, CX, PL>(
}

function updateHostRoot(current, workInProgress, renderExpirationTime) {
const root = (workInProgress.stateNode: FiberRoot);
pushHostRootContext(workInProgress);
const updateQueue = workInProgress.updateQueue;
if (updateQueue !== null) {
Expand Down
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 564c7e9

Please sign in to comment.