test for form submit commented out

This commit is contained in:
ogerly 2022-06-16 12:20:36 +02:00
parent 1a1d71e52f
commit e0796d46fd
2 changed files with 40 additions and 3 deletions

View File

@ -13,6 +13,8 @@ const mocks = {
$t: jest.fn((t) => t),
}
// const mockAPIcall = jest.fn()
describe('ContributionLinkForm', () => {
let wrapper
@ -59,10 +61,42 @@ describe('ContributionLinkForm', () => {
})
})
describe.skip('call onSubmit', () => {
describe('call onSubmit', () => {
it('response with the contribution link url', () => {
wrapper.vm.onSubmit()
})
})
// describe('successfull submit', () => {
// beforeEach(async () => {
// mockAPIcall.mockResolvedValue({
// data: {
// createContributionLink: {
// link: 'https://localhost/redeem/CL-1a2345678',
// },
// },
// })
// await wrapper.find('input.test-validFrom').setValue('2022-6-18')
// await wrapper.find('input.test-validTo').setValue('2022-7-18')
// await wrapper.find('input.test-name').setValue('test name')
// await wrapper.find('input.test-memo').setValue('test memo')
// await wrapper.find('input.test-amount').setValue('100')
// await wrapper.find('form').trigger('submit')
// })
// it('calls the API', () => {
// expect(mockAPIcall).toHaveBeenCalledWith(
// expect.objectContaining({
// variables: {
// link: 'https://localhost/redeem/CL-1a2345678',
// },
// }),
// )
// })
// it('displays the new username', () => {
// expect(wrapper.find('div.display-username').text()).toEqual('@username')
// })
// })
})
})

View File

@ -12,7 +12,7 @@
v-model="form.validFrom"
size="lg"
:min="min"
class="mb-4"
class="mb-4 test-validFrom"
reset-value=""
:label-no-date-selected="$t('contributionLink.noDateSelected')"
required
@ -25,7 +25,7 @@
v-model="form.validTo"
size="lg"
:min="form.validFrom ? form.validFrom : min"
class="mb-4"
class="mb-4 test-validTo"
reset-value=""
:label-no-date-selected="$t('contributionLink.noDateSelected')"
required
@ -43,6 +43,7 @@
placeholder="Name"
required
maxlength="100"
class="test-name"
></b-form-input>
</b-form-group>
<!-- Desc -->
@ -53,6 +54,7 @@
:placeholder="$t('contributionLink.memo')"
required
maxlength="255"
class="test-memo"
></b-form-textarea>
</b-form-group>
<!-- Amount -->
@ -63,6 +65,7 @@
type="number"
placeholder="0"
required
class="test-amount"
></b-form-input>
</b-form-group>
<b-collapse id="collapse-2">