18
18
import { createStore } from 'vuex'
19
19
import storeOptions from '@/store/options'
20
20
import CylcTreeCallback from '@/services/treeCallback'
21
+ import { vi } from 'vitest'
21
22
import sinon from 'sinon'
22
23
import { print } from 'graphql/language'
23
24
import gql from 'graphql-tag'
@@ -26,7 +27,6 @@ import 'cross-fetch/polyfill'
26
27
import Subscription from '@/model/Subscription.model'
27
28
import SubscriptionQuery from '@/model/SubscriptionQuery.model'
28
29
import WorkflowService from '@/services/workflow.service'
29
- import * as graphqlModule from '@/graphql/index'
30
30
import ViewState from '@/model/ViewState.model'
31
31
import { TreeCallback , WorkflowCallback } from './testCallback'
32
32
@@ -37,10 +37,6 @@ describe('WorkflowService', () => {
37
37
* @type {String }
38
38
*/
39
39
const url = '/graphql'
40
- /**
41
- * @type {ApolloClient }
42
- */
43
- let apolloClient
44
40
/**
45
41
* @type {SubscriptionClient|null }
46
42
*/
@@ -67,12 +63,15 @@ describe('WorkflowService', () => {
67
63
let subscription
68
64
beforeEach ( ( ) => {
69
65
sandbox . stub ( console , 'debug' )
70
- apolloClient = sandbox . spy ( {
71
- query : ( ) => { } ,
72
- subscribe : ( options ) => { }
73
- } )
66
+ vi . mock ( '@/graphql/index' , ( ) => ( {
67
+ createApolloClient : ( ) => ( {
68
+ query : vi . fn ( ) ,
69
+ subscribe : ( ) => ( {
70
+ subscribe : vi . fn ( )
71
+ } ) ,
72
+ } )
73
+ } ) )
74
74
subscriptionClient = null
75
- sandbox . stub ( graphqlModule , 'createApolloClient' ) . returns ( apolloClient )
76
75
// TODO: really load some mutations
77
76
sandbox . stub ( WorkflowService . prototype , 'loadTypes' ) . returns (
78
77
Promise . resolve ( {
0 commit comments