From e3d725ab19d6c1243b60ddc5b418f632105abb15 Mon Sep 17 00:00:00 2001 From: ogerly Date: Wed, 8 Jun 2022 10:22:49 +0200 Subject: [PATCH] add test ContributionLinkForm --- .../components/ContributionLinkForm.spec.js | 43 +++++++++++++++++++ admin/src/components/ContributionLinkForm.vue | 2 +- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 admin/src/components/ContributionLinkForm.spec.js diff --git a/admin/src/components/ContributionLinkForm.spec.js b/admin/src/components/ContributionLinkForm.spec.js new file mode 100644 index 000000000..e53aabaa7 --- /dev/null +++ b/admin/src/components/ContributionLinkForm.spec.js @@ -0,0 +1,43 @@ +import { mount } from '@vue/test-utils' +import ContributionLinkForm from './ContributionLinkForm.vue' + +const localVue = global.localVue + +const propsData = { + contributionLinkData: {}, +} +jest.spyOn(window, 'alert').mockReturnValue() + +const mocks = { + $t: jest.fn((t) => t), +} + +describe('ContributionLinkForm', () => { + let wrapper + + const Wrapper = () => { + return mount(ContributionLinkForm, { localVue, mocks, propsData }) + } + + describe('mount', () => { + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders the Div Element ".contribution-link-form"', () => { + expect(wrapper.find('div.contribution-link-form').exists()).toBeTruthy() + }) + + it('function onSubmit', () => { + wrapper.vm.onSubmit() + }) + + it('function onReset', () => { + wrapper.vm.onReset() + }) + + it('function updateForm', () => { + wrapper.vm.updateForm() + }) + }) +}) diff --git a/admin/src/components/ContributionLinkForm.vue b/admin/src/components/ContributionLinkForm.vue index a9441ce1c..d0bfb44da 100644 --- a/admin/src/components/ContributionLinkForm.vue +++ b/admin/src/components/ContributionLinkForm.vue @@ -1,5 +1,5 @@