Skip to content

Commit

Permalink
Rewrite skipEffects tests
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinhagemeister committed Apr 19, 2020
1 parent 61279d7 commit e9ad038
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions hooks/test/browser/hooks.options.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,21 +127,28 @@ describe('hook options', () => {
]);
});

it('should skip effect hooks', () => {
options._skipEffects = true;
const spy = sinon.spy();
function App() {
useEffect(spy, []);
useLayoutEffect(spy, []);
return null;
}
describe('Effects', () => {
beforeEach(() => {
options._skipEffects = options.__s = true;
});

act(() => {
render(<App />, scratch);
afterEach(() => {
options._skipEffects = options.__s = false;
});

expect(spy.callCount).to.equal(0);
it('should skip effect hooks', () => {
const spy = sinon.spy();
function App() {
useEffect(spy, []);
useLayoutEffect(spy, []);
return null;
}

options._skipEffects = false;
act(() => {
render(<App />, scratch);
});

expect(spy.callCount).to.equal(0);
});
});
});

0 comments on commit e9ad038

Please sign in to comment.