Alina Beck 77f4810ddc set up global localVue
by setting up localVue with all required plugins (such as styleguide and vuex)
in a separate testSetup file we can avoid doing this individually in all component tests
the testSetup is executed before each test suite, so each test file gets a fresh
instance of localVue
2019-11-20 12:31:40 +03:00

53 lines
1.1 KiB
JavaScript

import { mount } from '@vue/test-utils'
import AdminIndexPage from './index.vue'
import VueApollo from 'vue-apollo'
const localVue = global.localVue
localVue.use(VueApollo)
describe('admin/index.vue', () => {
let Wrapper
let store
let mocks
beforeEach(() => {
mocks = {
$t: jest.fn(),
}
})
describe('mount', () => {
Wrapper = () => {
return mount(AdminIndexPage, {
store,
mocks,
localVue,
})
}
describe('in loading state', () => {
beforeEach(() => {
mocks = { ...mocks, $apolloData: { loading: true } }
})
it.skip('shows a loading spinner', () => {
// I don't know how to mock the data that gets passed to
// ApolloQuery component
// What I found:
// https://github.com/Akryum/vue-apollo/issues/656
// https://github.com/Akryum/vue-apollo/issues/609
Wrapper()
const calls = mocks.$t.mock.calls
const expected = [['site.error-occurred']]
expect(calls).toEqual(expected)
})
})
describe('in error state', () => {
it.todo('displays an error message')
})
})
})