From 6a91de68084f11424a5e8c5e83476001f306a29f Mon Sep 17 00:00:00 2001 From: ogerly Date: Wed, 8 Jun 2022 08:33:07 +0200 Subject: [PATCH] test for ContributionLink --- admin/src/components/ContributionLink.spec.js | 32 +++++++++++++++++++ admin/src/components/ContributionLink.vue | 2 +- admin/src/components/ContributionLinkForm.vue | 2 +- 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 admin/src/components/ContributionLink.spec.js diff --git a/admin/src/components/ContributionLink.spec.js b/admin/src/components/ContributionLink.spec.js new file mode 100644 index 000000000..ae5ea4f58 --- /dev/null +++ b/admin/src/components/ContributionLink.spec.js @@ -0,0 +1,32 @@ +import { mount } from '@vue/test-utils' +import ContributionLink from './ContributionLink.vue' + +const localVue = global.localVue + +const mocks = { + $t: jest.fn((t) => t), +} + +describe('ContributionLink', () => { + let wrapper + + const Wrapper = () => { + return mount(ContributionLink, { localVue, mocks }) + } + + describe('mount', () => { + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders the Div Element ".contribution-link"', () => { + expect(wrapper.find('div.contribution-link').exists()).toBeTruthy() + }) + + it('emits toggle::collapse new Contribution', async () => { + wrapper.vm.editContributionLinkData() + // expect(wrapper.emitted('bv::toggle::collapse', 'newContribution')).toBeTruthy() + expect(wrapper.vm.$root.$emit('bv::toggle::collapse', 'newContribution')).toBeTruthy() + }) + }) +}) diff --git a/admin/src/components/ContributionLink.vue b/admin/src/components/ContributionLink.vue index cdba4ec02..02b525b44 100644 --- a/admin/src/components/ContributionLink.vue +++ b/admin/src/components/ContributionLink.vue @@ -1,5 +1,5 @@