From a36207f45c4f11660456b41ca91f29cf08392a9b Mon Sep 17 00:00:00 2001 From: Hironsan Date: Sun, 1 Sep 2019 16:24:58 +0900 Subject: [PATCH] Add unit test for container/ProjectDeletionButton --- .../containers/ProjectDeletionButton.spec.js | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 frontend/test/unit/components/containers/ProjectDeletionButton.spec.js diff --git a/frontend/test/unit/components/containers/ProjectDeletionButton.spec.js b/frontend/test/unit/components/containers/ProjectDeletionButton.spec.js new file mode 100644 index 00000000..c36bc115 --- /dev/null +++ b/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() + }) +})