Such an awesome response - I just did something similar but I needed to be able to mock in test so I have a service that looks like this
export default class AlertService { constructor(private client: ApolloClient<InMemoryCache>) { this.client = client; } // ... }
Then I inject the real client on Vue.js startup
Vue.js
Vue.prototype.$alertService = new AlertService(apolloProvider.defaultClient);
Then in a test I can inject a mock.
Awesome mock! I'm happy the reply was useful :)
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Such an awesome response - I just did something similar but I needed to be able to mock in test so I have a service that looks like this
Then I inject the real client on
Vue.js
startupThen in a test I can inject a mock.
Awesome mock! I'm happy the reply was useful :)