From 5314a374b5fb4d8456d889a388702d46f761939e Mon Sep 17 00:00:00 2001 From: Phil Pluckthun Date: Thu, 16 Mar 2023 01:51:17 +0000 Subject: [PATCH] Update tests --- packages/vue-urql/src/useMutation.test.ts | 5 ++++- packages/vue-urql/src/useQuery.test.ts | 9 +++++++-- packages/vue-urql/src/useSubscription.test.ts | 13 ++++++++++--- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/packages/vue-urql/src/useMutation.test.ts b/packages/vue-urql/src/useMutation.test.ts index f7d29b2f52..991bf7fdec 100644 --- a/packages/vue-urql/src/useMutation.test.ts +++ b/packages/vue-urql/src/useMutation.test.ts @@ -1,3 +1,4 @@ +import { OperationResult, OperationResultSource } from '@urql/core'; import { reactive } from 'vue'; import { vi, expect, it, beforeEach, describe } from 'vitest'; @@ -25,7 +26,9 @@ describe('useMutation', () => { const subject = makeSubject(); const clientMutation = vi .spyOn(client, 'executeMutation') - .mockImplementation(() => subject.source); + .mockImplementation( + () => subject.source as OperationResultSource + ); const mutation = reactive( useMutation( diff --git a/packages/vue-urql/src/useQuery.test.ts b/packages/vue-urql/src/useQuery.test.ts index f3a878ebf9..6ac721cccf 100644 --- a/packages/vue-urql/src/useQuery.test.ts +++ b/packages/vue-urql/src/useQuery.test.ts @@ -1,3 +1,4 @@ +import { OperationResult, OperationResultSource } from '@urql/core'; import { nextTick, reactive, ref } from 'vue'; import { vi, expect, it, describe } from 'vitest'; @@ -18,7 +19,9 @@ describe('useQuery', () => { const subject = makeSubject(); const executeQuery = vi .spyOn(client, 'executeQuery') - .mockImplementation(() => subject.source); + .mockImplementation( + () => subject.source as OperationResultSource + ); const _query = useQuery({ query: `{ test }`, @@ -109,7 +112,9 @@ describe('useQuery', () => { const subject = makeSubject(); const executeQuery = vi .spyOn(client, 'executeQuery') - .mockImplementation(() => subject.source); + .mockImplementation( + () => subject.source as OperationResultSource + ); const _query = useQuery({ query: `{ test }`, diff --git a/packages/vue-urql/src/useSubscription.test.ts b/packages/vue-urql/src/useSubscription.test.ts index 3c8e3b31f6..3ab0e57cb5 100644 --- a/packages/vue-urql/src/useSubscription.test.ts +++ b/packages/vue-urql/src/useSubscription.test.ts @@ -1,3 +1,4 @@ +import { OperationResult, OperationResultSource } from '@urql/core'; import { nextTick, reactive, ref } from 'vue'; import { vi, expect, it, describe } from 'vitest'; @@ -18,7 +19,9 @@ describe('useSubscription', () => { const subject = makeSubject(); const executeQuery = vi .spyOn(client, 'executeSubscription') - .mockImplementation(() => subject.source); + .mockImplementation( + () => subject.source as OperationResultSource + ); const sub = reactive( useSubscription({ @@ -60,7 +63,9 @@ describe('useSubscription', () => { const subject = makeSubject(); const executeSubscription = vi .spyOn(client, 'executeSubscription') - .mockImplementation(() => subject.source); + .mockImplementation( + () => subject.source as OperationResultSource + ); const variables = ref({}); const sub = reactive( @@ -101,7 +106,9 @@ describe('useSubscription', () => { const subject = makeSubject(); const executeSubscription = vi .spyOn(client, 'executeSubscription') - .mockImplementation(() => subject.source); + .mockImplementation( + () => subject.source as OperationResultSource + ); const scanHandler = (currentState: any, nextState: any) => ({ counter: (currentState ? currentState.counter : 0) + nextState.counter,