Skip to content

Commit

Permalink
test: update timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
afiiif committed Oct 16, 2023
1 parent aaa3e77 commit 67a8674
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions src/__tests__/react/create-mutation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('createMutation - without param', () => {
beforeEach(() => {
mutationFn = jest.fn().mockImplementation(async () => {
return new Promise((resolve) => {
setTimeout(() => resolve({ status: 'success' }), 33);
setTimeout(() => resolve({ status: 'success' }), 44);
});
});
useMutation = createMutation<Var, Response>(mutationFn);
Expand Down Expand Up @@ -68,7 +68,7 @@ describe('createMutation - with param', () => {
beforeEach(() => {
mutationFn = jest.fn().mockImplementation(async (param) => {
return new Promise((resolve) => {
setTimeout(() => resolve({ status: 'success', id: param.id }), 33);
setTimeout(() => resolve({ status: 'success', id: param.id }), 44);
});
});
useMutation = createMutation<Var, Response>(mutationFn);
Expand Down Expand Up @@ -133,7 +133,7 @@ describe('createMutation - with param', () => {
} else {
resolve({ status: 'success', id: param.id });
}
}, 33);
}, 44);
});
});
useMutation = createMutation<Var, Response>(mutationFn);
Expand Down Expand Up @@ -201,7 +201,7 @@ describe('createMutation - with param', () => {
} else {
resolve({ status: 'success', id: param.id });
}
}, 33);
}, 44);
});
});
useMutation = createMutation<Var, Response>(mutationFn, {
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/react/create-query/infinite-query.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('createQuery - infinite query', () => {
}
if (responses2[page]) resolve(responses2[page]);
else reject(new Error('Test error'));
}, 33);
}, 44);
});
});
useQuery = createQuery((_, { pageParam = 1 }) => queryFn({ page: pageParam }), {
Expand Down
24 changes: 12 additions & 12 deletions src/__tests__/react/create-query/single-query.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('createQuery - single query', () => {
beforeEach(() => {
queryFn = jest.fn().mockImplementation(async () => {
return new Promise((resolve) => {
setTimeout(() => resolve({ id: 1, name: 'test' }), 33);
setTimeout(() => resolve({ id: 1, name: 'test' }), 44);
});
});
useQuery = createQuery<Key, Response>(queryFn);
Expand Down Expand Up @@ -60,15 +60,15 @@ describe('createQuery - single query', () => {
queryFn = jest.fn().mockImplementation(async () => {
// Always error
return new Promise((_resolve, reject) => {
setTimeout(() => reject(new Error('Test error')), 33);
setTimeout(() => reject(new Error('Test error')), 44);
});
});
useQuery = createQuery<Key, Response>(queryFn);

const hook1 = renderHook(() => useQuery());
const hook2 = renderHook(() => useQuery());

const fetchingAndRetryDelay = 33 + 1000;
const fetchingAndRetryDelay = 44 + 1000;
await hook1.waitForNextUpdate({ timeout: 2 * fetchingAndRetryDelay + 300 });

const { current } = hook1.result;
Expand Down Expand Up @@ -100,7 +100,7 @@ describe('createQuery - single query', () => {
} else {
resolve({ id: 1, name: 'test' });
}
}, 33);
}, 44);
});
});
useQuery = createQuery<Key, Response>(queryFn, { retry: 3, retryDelay: 100 });
Expand Down Expand Up @@ -140,7 +140,7 @@ describe('createQuery - single query', () => {
} else {
resolve({ id: 1, name: 'test' });
}
}, 33);
}, 44);
});
});
useQuery = createQuery<Key, Response>(queryFn, { retryDelay: 100 });
Expand Down Expand Up @@ -194,7 +194,7 @@ describe('createQuery - single query', () => {
} else {
resolve({ id: 1, name: 'test' });
}
}, 33);
}, 44);
});
});
useQuery = createQuery<Key, Response>(queryFn, {
Expand Down Expand Up @@ -241,7 +241,7 @@ describe('createQuery - single query', () => {
} else {
resolve({ id: 1, name: 'test 2' });
}
}, 33);
}, 44);
});
});
useQuery = createQuery<Key, Response>(queryFn);
Expand Down Expand Up @@ -359,7 +359,7 @@ describe('createQuery - single query', () => {
setTimeout(() => {
const name = ['', 'A', 'B', 'C', 'D'][id];
resolve({ id, name });
}, 33);
}, 44);
});
});
useQuery = createQuery<Key, Response>(queryFn);
Expand Down Expand Up @@ -389,7 +389,7 @@ describe('createQuery - single query', () => {
}
}
resolve({ id, name });
}, 33);
}, 44);
});
});
useQuery = createQuery<Key, Response, string>(queryFn, {
Expand Down Expand Up @@ -466,7 +466,7 @@ describe('createQuery - single query', () => {

const queryFn2 = jest.fn().mockImplementation(async ({ id }) => {
return new Promise((resolve) => {
setTimeout(() => resolve({ id, name: 'test' }), 33);
setTimeout(() => resolve({ id, name: 'test' }), 44);
});
});

Expand All @@ -488,7 +488,7 @@ describe('createQuery - single query', () => {
expect(queryFn2).toHaveBeenCalledTimes(1);

await act(async () => {
await new Promise((r) => setTimeout(r, 33));
await new Promise((r) => setTimeout(r, 100));
fireEvent(window, new Event('focus'));
});
await hook2.waitForNextUpdate();
Expand All @@ -497,7 +497,7 @@ describe('createQuery - single query', () => {

hook2.unmount();
await act(async () => {
await new Promise((r) => setTimeout(r, 33));
await new Promise((r) => setTimeout(r, 100));
fireEvent(window, new Event('focus'));
});
await hook1.waitForNextUpdate();
Expand Down

1 comment on commit 67a8674

@vercel
Copy link

@vercel vercel bot commented on 67a8674 Oct 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

demo-floppy-disk – ./comparison/nextjs/with-floppy-disk

demo-floppy-disk-git-main-afiiif.vercel.app
demo-floppy-disk-afiiif.vercel.app
demo-floppy-disk.vercel.app

Please sign in to comment.