test Send.spec.js, two apollo querys

This commit is contained in:
ogerly 2022-03-14 11:17:26 +01:00
parent 86e956f320
commit 7893a5d09c

View File

@ -1,11 +1,12 @@
import { mount } from '@vue/test-utils'
import Send from './Send'
import { toastErrorSpy } from '../../test/testSetup'
const sendCoinsMock = jest.fn()
sendCoinsMock.mockResolvedValue('success')
const createTransactionLinkMock = jest.fn()
createTransactionLinkMock.mockResolvedValue('success')
createTransactionLinkMock.mockResolvedValue('error')
const localVue = global.localVue
@ -154,6 +155,18 @@ describe('Send', () => {
})
})
describe('send apollo if transaction link with error', () => {
beforeEach(() => {
createTransactionLinkMock.mockRejectedValue({ message: 'OUCH!' })
wrapper = Wrapper()
wrapper.find('button.btn-success').trigger('click')
})
it('toasts an error message', () => {
expect(toastErrorSpy).toBeCalledWith('unregister_mail.error')
})
})
describe('confirm transaction if selected:link', () => {
beforeEach(() => {
wrapper.setData({