From e3e5fdd12b4566287bd9e28b8761c73b8ef22abd Mon Sep 17 00:00:00 2001 From: ogerly Date: Fri, 16 Sep 2022 08:22:24 +0200 Subject: [PATCH] remove modal box if redeem a redeemlink --- .../LinkInformations/RedeemValid.vue | 2 +- frontend/src/pages/TransactionLink.spec.js | 56 +++++++++---------- frontend/src/pages/TransactionLink.vue | 7 +-- 3 files changed, 30 insertions(+), 35 deletions(-) diff --git a/frontend/src/components/LinkInformations/RedeemValid.vue b/frontend/src/components/LinkInformations/RedeemValid.vue index 353fefaf8..c468a396a 100644 --- a/frontend/src/components/LinkInformations/RedeemValid.vue +++ b/frontend/src/components/LinkInformations/RedeemValid.vue @@ -3,7 +3,7 @@
- + {{ $t('gdd_per_link.redeem') }}
diff --git a/frontend/src/pages/TransactionLink.spec.js b/frontend/src/pages/TransactionLink.spec.js index b1bbd8950..fd58d6e1c 100644 --- a/frontend/src/pages/TransactionLink.spec.js +++ b/frontend/src/pages/TransactionLink.spec.js @@ -282,18 +282,18 @@ describe('TransactionLink', () => { }) describe('redeem link with success', () => { - let spy + // let spy beforeEach(async () => { - spy = jest.spyOn(wrapper.vm.$bvModal, 'msgBoxConfirm') + // spy = jest.spyOn(wrapper.vm.$bvModal, 'msgBoxConfirm') apolloMutateMock.mockResolvedValue() - spy.mockImplementation(() => Promise.resolve(true)) + // spy.mockImplementation(() => Promise.resolve(true)) await wrapper.findComponent({ name: 'RedeemValid' }).find('button').trigger('click') }) - it('opens the modal', () => { - expect(spy).toBeCalledWith('gdd_per_link.redeem-text') - }) + // it('opens the modal', () => { + // expect(spy).toBeCalledWith('gdd_per_link.redeem-text') + // }) it('calls the API', () => { expect(apolloMutateMock).toBeCalledWith( @@ -316,37 +316,37 @@ describe('TransactionLink', () => { }) }) - describe('cancel redeem link', () => { - let spy + // describe('cancel redeem link', () => { + // let spy - beforeEach(async () => { - spy = jest.spyOn(wrapper.vm.$bvModal, 'msgBoxConfirm') - apolloMutateMock.mockResolvedValue() - spy.mockImplementation(() => Promise.resolve(false)) - await wrapper.findComponent({ name: 'RedeemValid' }).find('button').trigger('click') - }) + // beforeEach(async () => { + // spy = jest.spyOn(wrapper.vm.$bvModal, 'msgBoxConfirm') + // apolloMutateMock.mockResolvedValue() + // spy.mockImplementation(() => Promise.resolve(false)) + // await wrapper.findComponent({ name: 'RedeemValid' }).find('button').trigger('click') + // }) - it('does not call the API', () => { - expect(apolloMutateMock).not.toBeCalled() - }) + // it('does not call the API', () => { + // expect(apolloMutateMock).not.toBeCalled() + // }) - it('does not toasts a success message', () => { - expect(mocks.$t).not.toBeCalledWith('gdd_per_link.redeemed', { n: '22' }) - expect(toastSuccessSpy).not.toBeCalled() - }) + // it('does not toasts a success message', () => { + // expect(mocks.$t).not.toBeCalledWith('gdd_per_link.redeemed', { n: '22' }) + // expect(toastSuccessSpy).not.toBeCalled() + // }) - it('does not push the route', () => { - expect(routerPushMock).not.toBeCalled() - }) - }) + // it('does not push the route', () => { + // expect(routerPushMock).not.toBeCalled() + // }) + // }) describe('redeem link with error', () => { - let spy + // let spy beforeEach(async () => { - spy = jest.spyOn(wrapper.vm.$bvModal, 'msgBoxConfirm') + // spy = jest.spyOn(wrapper.vm.$bvModal, 'msgBoxConfirm') apolloMutateMock.mockRejectedValue({ message: 'Oh Noo!' }) - spy.mockImplementation(() => Promise.resolve(true)) + // spy.mockImplementation(() => Promise.resolve(true)) await wrapper.findComponent({ name: 'RedeemValid' }).find('button').trigger('click') }) diff --git a/frontend/src/pages/TransactionLink.vue b/frontend/src/pages/TransactionLink.vue index 57236b55c..bd1909d7d 100644 --- a/frontend/src/pages/TransactionLink.vue +++ b/frontend/src/pages/TransactionLink.vue @@ -14,7 +14,7 @@ @@ -98,11 +98,6 @@ export default { this.$router.push('/overview') }) }, - redeemLink(amount) { - this.$bvModal.msgBoxConfirm(this.$t('gdd_per_link.redeem-text')).then((value) => { - if (value) this.mutationLink(amount) - }) - }, }, computed: { isContributionLink() {