diff --git a/admin/src/App.spec.js b/admin/src/App.spec.js index b47141972..e77bc578b 100644 --- a/admin/src/App.spec.js +++ b/admin/src/App.spec.js @@ -1,43 +1,20 @@ -import { mount } from '@vue/test-utils' +import { shallowMount } from '@vue/test-utils' import App from './App' const localVue = global.localVue -const storeCommitMock = jest.fn() - -const mocks = { - $store: { - commit: storeCommitMock, - }, +const stubs = { + RouterView: true, } -const localStorageMock = (() => { - let store = {} - - return { - getItem: (key) => { - return store[key] || null - }, - setItem: (key, value) => { - store[key] = value.toString() - }, - removeItem: (key) => { - delete store[key] - }, - clear: () => { - store = {} - }, - } -})() - describe('App', () => { let wrapper const Wrapper = () => { - return mount(App, { localVue, mocks }) + return shallowMount(App, { localVue, stubs }) } - describe('mount', () => { + describe('shallowMount', () => { beforeEach(() => { wrapper = Wrapper() }) @@ -46,23 +23,4 @@ describe('App', () => { expect(wrapper.find('div#app').exists()).toBeTruthy() }) }) - - describe('window localStorage is undefined', () => { - it('does not commit a token to the store', () => { - expect(storeCommitMock).not.toBeCalled() - }) - }) - - describe('with token in local storage', () => { - beforeEach(() => { - Object.defineProperty(window, 'localStorage', { - value: localStorageMock, - }) - window.localStorage.setItem('vuex', JSON.stringify({ token: 1234 })) - }) - - it.skip('commits the token to the store', () => { - expect(storeCommitMock).toBeCalledWith('token', 1234) - }) - }) }) diff --git a/admin/src/App.vue b/admin/src/App.vue index 70bc2978a..a76b1dcab 100644 --- a/admin/src/App.vue +++ b/admin/src/App.vue @@ -2,18 +2,18 @@