Created
March 24, 2019 18:30
-
-
Save camwhite/1d155b92ed73c166d43b47a35b899cb9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { expect } from 'chai' | |
| import { spy } from 'sinon' | |
| import { shallowMount, createLocalVue } from '@vue/test-utils' | |
| import VueRouter from 'vue-router' | |
| import Vuex from 'vuex' | |
| import Sidenav from '@/components/SideNav.vue' | |
| const localVue = createLocalVue() | |
| localVue.use(Vuex) | |
| localVue.use(VueRouter) | |
| const router = new VueRouter() | |
| describe('Sidenav.vue', () => { | |
| let actions, state, store | |
| beforeEach(() => { | |
| state = { | |
| pages: [] | |
| } | |
| actions = { | |
| fetchPages: spy() | |
| } | |
| store = new Vuex.Store({ | |
| state, | |
| actions | |
| }) | |
| }) | |
| it('calls prefetched pages', () => { | |
| const wrapper = shallowMount(Sidenav, { | |
| store, | |
| localVue, | |
| router | |
| }) | |
| console.log(actions) | |
| expect(actions.fetchPages).should.have.been.called | |
| }) | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment