Skip to content

Commit

Permalink
test: do not use done() callback (jestjs/jest#10529)
Browse files Browse the repository at this point in the history
  • Loading branch information
pablo1v committed Jul 1, 2021
1 parent 538451e commit 3e611ea
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions reactools/__tests__/hooks/useForceUpdate.test.ts
Expand Up @@ -4,18 +4,19 @@ import { act } from 'react-test-renderer';
import { useForceUpdate } from '@/hooks/useForceUpdate';

describe('useForceUpdate', () => {
it('should value must always be updated', async done => {
it('should value must always be updated', async () => {
const { result: forceUpdate, waitForNextUpdate } = renderHook(() =>
useForceUpdate(),
);

await expect(waitForNextUpdate()).rejects.toEqual(expect.anything());

act(() => {
setTimeout(() => {
forceUpdate.current();
}, 500);
});

await waitForNextUpdate();
done();
await expect(waitForNextUpdate()).resolves.toBe(undefined);
});
});

0 comments on commit 3e611ea

Please sign in to comment.