Skip to content

Commit 7af298a

Browse files
committed
Comment out vue-apollo (relies on vue2)
1 parent a1fca69 commit 7af298a

File tree

1 file changed

+60
-59
lines changed

1 file changed

+60
-59
lines changed

src/__tests__/vue-apollo.js

Lines changed: 60 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,75 @@
1-
import '@testing-library/jest-dom'
2-
import fetch from 'isomorphic-unfetch'
3-
import {render, fireEvent, screen} from '@testing-library/vue'
4-
import VueApollo from 'vue-apollo'
5-
import {InMemoryCache} from 'apollo-cache-inmemory'
6-
import ApolloClient from 'apollo-boost'
1+
test.todo('Your test suite must contain at least one test.')
2+
// import '@testing-library/jest-dom'
3+
// import fetch from 'isomorphic-unfetch'
4+
// import {render, fireEvent, screen} from '@testing-library/vue'
5+
// import VueApollo from 'vue-apollo'
6+
// import {InMemoryCache} from 'apollo-cache-inmemory'
7+
// import ApolloClient from 'apollo-boost'
78

8-
// Since vue-apollo doesn't provides a MockProvider for Vue,
9-
// you need to use some kind of mocks for the queries.
9+
// // Since vue-apollo doesn't provides a MockProvider for Vue,
10+
// // you need to use some kind of mocks for the queries.
1011

11-
// We recommend using Mock Service Worker library to declaratively mock API communication
12-
// in your tests instead of stubbing window.fetch, or relying on third-party adapters.
12+
// // We recommend using Mock Service Worker library to declaratively mock API communication
13+
// // in your tests instead of stubbing window.fetch, or relying on third-party adapters.
1314

14-
import {setupServer} from 'msw/node'
15-
import {graphql} from 'msw'
15+
// import {setupServer} from 'msw/node'
16+
// import {graphql} from 'msw'
1617

17-
import Component from './components/VueApollo.vue'
18+
// import Component from './components/VueApollo.vue'
1819

19-
const apolloClient = new ApolloClient({
20-
uri: 'http://localhost:3020/graphql',
21-
cache: new InMemoryCache({
22-
addTypename: false,
23-
}),
24-
fetch,
25-
})
20+
// const apolloClient = new ApolloClient({
21+
// uri: 'http://localhost:3020/graphql',
22+
// cache: new InMemoryCache({
23+
// addTypename: false,
24+
// }),
25+
// fetch,
26+
// })
2627

27-
const server = setupServer(
28-
...[
29-
graphql.mutation('updateUser', (req, res, ctx) => {
30-
const {variables} = req
28+
// const server = setupServer(
29+
// ...[
30+
// graphql.mutation('updateUser', (req, res, ctx) => {
31+
// const {variables} = req
3132

32-
return res(
33-
ctx.data({
34-
updateUser: {id: variables.input.id, email: variables.input.email},
35-
}),
36-
)
37-
}),
38-
graphql.query('User', (req, res, ctx) => {
39-
return res(ctx.data({user: {id: '1', email: '[email protected]'}}))
40-
}),
41-
],
42-
)
33+
// return res(
34+
// ctx.data({
35+
// updateUser: {id: variables.input.id, email: variables.input.email},
36+
// }),
37+
// )
38+
// }),
39+
// graphql.query('User', (req, res, ctx) => {
40+
// return res(ctx.data({user: {id: '1', email: 'alice@example.com'}}))
41+
// }),
42+
// ],
43+
// )
4344

44-
beforeAll(() => server.listen())
45-
afterEach(() => server.resetHandlers())
46-
afterAll(() => server.close())
45+
// beforeAll(() => server.listen())
46+
// afterEach(() => server.resetHandlers())
47+
// afterAll(() => server.close())
4748

48-
test('mocking queries and mutations', async () => {
49-
render(Component, {props: {id: '1'}}, localVue => {
50-
localVue.use(VueApollo)
49+
// test('mocking queries and mutations', async () => {
50+
// render(Component, {props: {id: '1'}}, localVue => {
51+
// localVue.use(VueApollo)
5152

52-
return {
53-
apolloProvider: new VueApollo({defaultClient: apolloClient}),
54-
}
55-
})
53+
// return {
54+
// apolloProvider: new VueApollo({defaultClient: apolloClient}),
55+
// }
56+
// })
5657

57-
//Initial rendering will be in the loading state,
58-
expect(screen.getByText('Loading')).toBeInTheDocument()
58+
// //Initial rendering will be in the loading state,
59+
// expect(screen.getByText('Loading')).toBeInTheDocument()
5960

60-
expect(
61-
await screen.findByText('Email: [email protected]'),
62-
).toBeInTheDocument()
61+
// expect(
62+
// await screen.findByText('Email: [email protected]'),
63+
// ).toBeInTheDocument()
6364

64-
await fireEvent.update(
65-
screen.getByLabelText('Email'),
66-
67-
)
65+
// await fireEvent.update(
66+
// screen.getByLabelText('Email'),
67+
68+
// )
6869

69-
await fireEvent.click(screen.getByRole('button', {name: 'Change email'}))
70+
// await fireEvent.click(screen.getByRole('button', {name: 'Change email'}))
7071

71-
expect(
72-
await screen.findByText('Email: [email protected]'),
73-
).toBeInTheDocument()
74-
})
72+
// expect(
73+
// await screen.findByText('Email: [email protected]'),
74+
// ).toBeInTheDocument()
75+
// })

0 commit comments

Comments
 (0)