Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ jobs:
name: Tests
command: yarn test
environment:
HTTP_ENDPOINT: https://api.graph.cool/simple/v1/cjvqu5trs23l90138hm4t8uof
WS_ENDPOINT: wss://subscriptions.us-west-2.graph.cool/v1/cjvqu5trs23l90138hm4t8uof
HTTP_ENDPOINT: https://rickandmortyapi.com/graphql
WS_ENDPOINT: wss://subscriptions.us-west-2.graph.cool/v1/cjvqu5trs23l90138hm4t8uof
2 changes: 1 addition & 1 deletion test/fixture-local-state/plugins/apollo-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function (ctx) {
}
}
},
onCacheInit: cache => {
onCacheInit: (cache) => {
const data = {
connected: false
}
Expand Down
14 changes: 7 additions & 7 deletions test/fixture/pages/asyncData.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div>
<div v-for="post in allPosts" :key="post.id">{{ post.id }}</div>
<div v-for="episode in episodesByIds" :key="episode.name">{{ episode.name }}</div>
</div>
</template>

Expand All @@ -15,19 +15,19 @@ export default {
},
data () {
return {
allPosts: []
episodesByIds: []
}
},
async asyncData({ app }) {
const client = app.apolloProvider.defaultClient
const allPosts = await client.query({
const episodesByIds = await client.query({
query: gql`{
allPosts {
id
episodesByIds(ids: [1]) {
name
}
}`
}).then(({ data }) => data && data.allPosts)
return { allPosts }
}).then(({ data }) => data && data.episodesByIds)
return { episodesByIds }
}
}
</script>
12 changes: 6 additions & 6 deletions test/fixture/pages/mounted.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div>
<div v-for="post in allPosts" :key="post.id">{{ post.id }}</div>
<div v-for="episode in episodesByIds" :key="episode.name">{{ episode.name }}</div>
</div>
</template>

Expand All @@ -15,17 +15,17 @@ export default {
},
data () {
return {
allPosts: []
episodesByIds: []
}
},
async mounted() {
this.allPosts = await this.$apollo.query({
this.episodesByIds = await this.$apollo.query({
query: gql`{
allPosts {
id
episodesByIds(ids: [1]) {
name
}
}`
}).then(({ data }) => data && data.allPosts)
}).then(({ data }) => data && data.episodesByIds)
}
}
</script>
10 changes: 5 additions & 5 deletions test/fixture/pages/normalQuery.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div>
<div v-for="post in allPosts" :key="post.id">{{ post.id }}</div>
<div v-for="episode in episodesByIds" :key="episode.name">{{ episode.name }}</div>
</div>
</template>

Expand All @@ -15,14 +15,14 @@ export default {
},
data () {
return {
allPosts: []
episodesByIds: []
}
},
apollo: {
allPosts: {
episodesByIds: {
query: gql`{
allPosts {
id
episodesByIds(ids: [1]) {
name
}
}`
}
Expand Down
4 changes: 2 additions & 2 deletions test/module.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ describe('basic', () => {

test('normalQuery', async () => {
const html = await get('/normalQuery')
expect(html).toContain('cjw1jhoxi1f4g0112ayaq3pyz')
expect(html).toContain('Pilot')
})

test('asyncData', async () => {
const html = await get('/asyncData')
expect(html).toContain('cjw1jhoxi1f4g0112ayaq3pyz')
expect(html).toContain('Pilot')
})

test('mounted & smart query', async () => {
Expand Down