add test ContributionLinkForm

This commit is contained in:
ogerly 2022-06-08 10:22:49 +02:00
parent 530c65f86f
commit e3d725ab19
2 changed files with 44 additions and 1 deletions

View File

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

View File

@ -1,5 +1,5 @@
<template>
<div>
<div class="contribution-link-form">
<div v-if="updateData" class="text-light bg-info p-3">
{{ updateData }}
</div>