Skip to content

Instantly share code, notes, and snippets.

@camwhite
Created March 24, 2019 18:30
Show Gist options
  • Select an option

  • Save camwhite/1d155b92ed73c166d43b47a35b899cb9 to your computer and use it in GitHub Desktop.

Select an option

Save camwhite/1d155b92ed73c166d43b47a35b899cb9 to your computer and use it in GitHub Desktop.
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