Browse Source

Add unit test for container/ProjectDeletionButton

pull/341/head
Hironsan 5 years ago
parent
commit
a36207f45c
1 changed files with 40 additions and 0 deletions
  1. 40
      frontend/test/unit/components/containers/ProjectDeletionButton.spec.js

40
frontend/test/unit/components/containers/ProjectDeletionButton.spec.js

@ -0,0 +1,40 @@
import { shallowMount, createLocalVue } from '@vue/test-utils'
import Vue from 'vue'
import Vuex from 'vuex'
import Vuetify from 'vuetify'
import ProjectDeletionButton from '@/components/containers/ProjectDeletionButton'
const localVue = createLocalVue()
localVue.use(Vuex)
Vue.use(Vuetify)
describe('ProjectDeletionButtonContainer', () => {
let store
let projects
let actions
let mutations
beforeEach(() => {
actions = {
deleteProject: jest.fn()
}
mutations = {}
projects = {
namespaced: true,
actions,
mutations,
state: {}
}
store = new Vuex.Store({
modules: {
projects
}
})
})
test('called deleteProject action', () => {
const wrapper = shallowMount(ProjectDeletionButton, { store, localVue })
wrapper.vm.handleDeleteProject()
expect(actions.deleteProject).toHaveBeenCalled()
})
})
Loading…
Cancel
Save