From 28c9291498b90219b4401aaaa54cc5a61d41a26e Mon Sep 17 00:00:00 2001 From: Dominik Dorfmeister Date: Tue, 28 Dec 2021 22:28:27 +0100 Subject: [PATCH] refactor: remove cancel method as it no longer exists it wasn't doing anything in that test --- src/reactjs/tests/useQuery.test.tsx | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/reactjs/tests/useQuery.test.tsx b/src/reactjs/tests/useQuery.test.tsx index 44d0ac4caf..c0803b4b97 100644 --- a/src/reactjs/tests/useQuery.test.tsx +++ b/src/reactjs/tests/useQuery.test.tsx @@ -4268,17 +4268,9 @@ describe('useQuery', () => { const key = queryKey() const states: UseQueryResult[] = [] - const queryFn = () => { - let cancelFn = jest.fn() - - const promise = new Promise((resolve, reject) => { - cancelFn = jest.fn(() => reject('Cancelled')) - sleep(50).then(() => resolve('OK')) - }) - - ;(promise as any).cancel = cancelFn - - return promise + const queryFn = async () => { + await sleep(50) + return 'OK' } function Page() {