test for ContributionLink

This commit is contained in:
ogerly 2022-06-08 08:33:07 +02:00
parent bbd0fd6478
commit 6a91de6808
3 changed files with 34 additions and 2 deletions

View File

@ -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()
})
})
})

View File

@ -1,5 +1,5 @@
<template>
<div>
<div class="contribution-link">
<b-card
border-variant="success"
:header="$t('contributionLink.contributionLinks')"

View File

@ -193,7 +193,7 @@ export default {
},
watch: {
contributionLinkData() {
alert('change contributionLinkData')
// alert('change contributionLinkData')
this.form.name = this.contributionLinkData.name
this.form.memo = this.contributionLinkData.memo
this.form.amount = this.contributionLinkData.amount