Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kitten committed Mar 16, 2023
1 parent cfdac55 commit 5314a37
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
5 changes: 4 additions & 1 deletion packages/vue-urql/src/useMutation.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { OperationResult, OperationResultSource } from '@urql/core';
import { reactive } from 'vue';
import { vi, expect, it, beforeEach, describe } from 'vitest';

Expand Down Expand Up @@ -25,7 +26,9 @@ describe('useMutation', () => {
const subject = makeSubject<any>();
const clientMutation = vi
.spyOn(client, 'executeMutation')
.mockImplementation(() => subject.source);
.mockImplementation(
() => subject.source as OperationResultSource<OperationResult>
);

const mutation = reactive(
useMutation(
Expand Down
9 changes: 7 additions & 2 deletions packages/vue-urql/src/useQuery.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { OperationResult, OperationResultSource } from '@urql/core';
import { nextTick, reactive, ref } from 'vue';
import { vi, expect, it, describe } from 'vitest';

Expand All @@ -18,7 +19,9 @@ describe('useQuery', () => {
const subject = makeSubject<any>();
const executeQuery = vi
.spyOn(client, 'executeQuery')
.mockImplementation(() => subject.source);
.mockImplementation(
() => subject.source as OperationResultSource<OperationResult>
);

const _query = useQuery({
query: `{ test }`,
Expand Down Expand Up @@ -109,7 +112,9 @@ describe('useQuery', () => {
const subject = makeSubject<any>();
const executeQuery = vi
.spyOn(client, 'executeQuery')
.mockImplementation(() => subject.source);
.mockImplementation(
() => subject.source as OperationResultSource<OperationResult>
);

const _query = useQuery({
query: `{ test }`,
Expand Down
13 changes: 10 additions & 3 deletions packages/vue-urql/src/useSubscription.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { OperationResult, OperationResultSource } from '@urql/core';
import { nextTick, reactive, ref } from 'vue';
import { vi, expect, it, describe } from 'vitest';

Expand All @@ -18,7 +19,9 @@ describe('useSubscription', () => {
const subject = makeSubject<any>();
const executeQuery = vi
.spyOn(client, 'executeSubscription')
.mockImplementation(() => subject.source);
.mockImplementation(
() => subject.source as OperationResultSource<OperationResult>
);

const sub = reactive(
useSubscription({
Expand Down Expand Up @@ -60,7 +63,9 @@ describe('useSubscription', () => {
const subject = makeSubject<any>();
const executeSubscription = vi
.spyOn(client, 'executeSubscription')
.mockImplementation(() => subject.source);
.mockImplementation(
() => subject.source as OperationResultSource<OperationResult>
);

const variables = ref({});
const sub = reactive(
Expand Down Expand Up @@ -101,7 +106,9 @@ describe('useSubscription', () => {
const subject = makeSubject<any>();
const executeSubscription = vi
.spyOn(client, 'executeSubscription')
.mockImplementation(() => subject.source);
.mockImplementation(
() => subject.source as OperationResultSource<OperationResult>
);

const scanHandler = (currentState: any, nextState: any) => ({
counter: (currentState ? currentState.counter : 0) + nextState.counter,
Expand Down

0 comments on commit 5314a37

Please sign in to comment.