Skip to content

Commit

Permalink
resolve promise and then rerender
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock committed Oct 21, 2020
1 parent 313549d commit e5e24af
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions hooks/test/browser/useEffect.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ describe('useEffect', () => {

increment = () => {
setCount(x => x + 1);
promise = Promise(res => {
promise = new Promise(res => {
setTimeout(() => {
setCount(x => x + 1);
res();
Expand All @@ -364,10 +364,10 @@ describe('useEffect', () => {
act(() => {
increment();
});

await act(async () => {
await promise;
});
expect(scratch.innerHTML).to.equal('');
await promise;
act(() => {});
expect(scratch.innerHTML).to.equal(
'<div><div>Count: 2</div><div><div>dummy</div></div></div>'
);
});
});

0 comments on commit e5e24af

Please sign in to comment.