From a565fd5036b23810f59b49affc69a36cdb434a55 Mon Sep 17 00:00:00 2001 From: Brian Kim Date: Tue, 25 Jan 2022 14:46:47 -0500 Subject: [PATCH] re-add onSubscriptionData mock to test --- src/react/hooks/__tests__/useSubscription.test.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/react/hooks/__tests__/useSubscription.test.tsx b/src/react/hooks/__tests__/useSubscription.test.tsx index 3666360e70f..caeb9949f06 100644 --- a/src/react/hooks/__tests__/useSubscription.test.tsx +++ b/src/react/hooks/__tests__/useSubscription.test.tsx @@ -135,10 +135,12 @@ describe('useSubscription Hook', () => { cache: new Cache({ addTypename: false }) }); + const onSubscriptionData = jest.fn(); const { result, unmount, waitForNextUpdate, rerender } = renderHook( ({ variables }) => useSubscription(subscription, { variables, - skip: true + skip: true, + onSubscriptionData, }), { initialProps: { @@ -159,10 +161,11 @@ describe('useSubscription Hook', () => { expect(result.current.data).toBe(undefined); rerender({ variables: { foo: 'bar2' }}); - expect(onSetup).toHaveBeenCalledTimes(0); - await expect(waitForNextUpdate({ timeout: 20 })) .rejects.toThrow('Timed out'); + + expect(onSetup).toHaveBeenCalledTimes(0); + expect(onSubscriptionData).toHaveBeenCalledTimes(0); unmount(); });