diff --git a/admin/src/components/ContributionLinkForm.spec.js b/admin/src/components/ContributionLinkForm.spec.js index 849d6a9da..9c7c33c52 100644 --- a/admin/src/components/ContributionLinkForm.spec.js +++ b/admin/src/components/ContributionLinkForm.spec.js @@ -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') + // }) + // }) }) }) diff --git a/admin/src/components/ContributionLinkForm.vue b/admin/src/components/ContributionLinkForm.vue index cac126efd..6fb9ee594 100644 --- a/admin/src/components/ContributionLinkForm.vue +++ b/admin/src/components/ContributionLinkForm.vue @@ -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" > @@ -53,6 +54,7 @@ :placeholder="$t('contributionLink.memo')" required maxlength="255" + class="test-memo" > @@ -63,6 +65,7 @@ type="number" placeholder="0" required + class="test-amount" >