From 6bd44f6eb94f6e5eccf91020d7827c8a1e892d3f Mon Sep 17 00:00:00 2001 From: ogerly Date: Thu, 24 Mar 2022 09:10:31 +0100 Subject: [PATCH] test qr code button and modal --- .../TransactionLinks/TransactionLink.spec.js | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/TransactionLinks/TransactionLink.spec.js b/frontend/src/components/TransactionLinks/TransactionLink.spec.js index f019a0ee1..fd1ac4bf4 100644 --- a/frontend/src/components/TransactionLinks/TransactionLink.spec.js +++ b/frontend/src/components/TransactionLinks/TransactionLink.spec.js @@ -76,6 +76,27 @@ describe('TransactionLink', () => { }) }) + describe('qr code modal', () => { + let spy + + beforeEach(() => { + jest.clearAllMocks() + }) + + describe.only('with success', () => { + beforeEach(async () => { + spy = jest.spyOn(wrapper.vm.$bvModal, 'show') + // spy.mockImplementation(() => Promise.resolve('some value')) + // mockAPIcall.mockResolvedValue() + await wrapper.findAll('button').at(1).trigger('click') + }) + + it('qr-code Modal if show', () => { + expect(spy).toBeCalled() + }) + }) + }) + describe('delete link', () => { let spy @@ -88,7 +109,7 @@ describe('TransactionLink', () => { spy = jest.spyOn(wrapper.vm.$bvModal, 'msgBoxConfirm') spy.mockImplementation(() => Promise.resolve('some value')) mockAPIcall.mockResolvedValue() - await wrapper.findAll('button').at(1).trigger('click') + await wrapper.findAll('button').at(2).trigger('click') }) it('test Modal if confirm true', () => { @@ -120,7 +141,7 @@ describe('TransactionLink', () => { spy = jest.spyOn(wrapper.vm.$bvModal, 'msgBoxConfirm') spy.mockImplementation(() => Promise.resolve('some value')) mockAPIcall.mockRejectedValue({ message: 'Something went wrong :(' }) - await wrapper.findAll('button').at(1).trigger('click') + await wrapper.findAll('button').at(2).trigger('click') }) it('toasts an error message', () => {