mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
adapt existing unit tests for copying a created transaction link
This commit is contained in:
parent
80eaf1c8ea
commit
21c9bc22a7
@ -20,6 +20,9 @@ describe('Send', () => {
|
||||
balance: 123.45,
|
||||
GdtBalance: 1234.56,
|
||||
pending: true,
|
||||
amount: '15',
|
||||
link: 'http://localhost/redeem/0123456789',
|
||||
memo: 'Quis auctor elit sed vulputate mi sit amet mauris commodo quis imperdiet.',
|
||||
}
|
||||
|
||||
const mocks = {
|
||||
@ -28,6 +31,7 @@ describe('Send', () => {
|
||||
$store: {
|
||||
state: {
|
||||
email: 'sender@example.org',
|
||||
firstName: 'Testy',
|
||||
},
|
||||
},
|
||||
$apollo: {
|
||||
@ -228,21 +232,26 @@ describe('Send', () => {
|
||||
navigator.clipboard = navigatorClipboard
|
||||
})
|
||||
|
||||
describe('copy with success', () => {
|
||||
describe('copy link with success', () => {
|
||||
beforeEach(async () => {
|
||||
navigatorClipboardMock.mockResolvedValue()
|
||||
await wrapper.findAll('button').at(0).trigger('click')
|
||||
await wrapper.findAll('button').at(1).trigger('click')
|
||||
})
|
||||
|
||||
it('should call clipboard.writeText', () => {
|
||||
expect(navigator.clipboard.writeText).toHaveBeenCalledWith(
|
||||
'http://localhost/redeem/0123456789',
|
||||
)
|
||||
})
|
||||
it('toasts success message', () => {
|
||||
expect(toastSuccessSpy).toBeCalledWith('gdd_per_link.link-copied')
|
||||
})
|
||||
})
|
||||
|
||||
describe('copy with error', () => {
|
||||
describe('copy link with error', () => {
|
||||
beforeEach(async () => {
|
||||
navigatorClipboardMock.mockRejectedValue()
|
||||
await wrapper.findAll('button').at(0).trigger('click')
|
||||
await wrapper.findAll('button').at(1).trigger('click')
|
||||
})
|
||||
|
||||
it('toasts error message', () => {
|
||||
@ -253,7 +262,7 @@ describe('Send', () => {
|
||||
|
||||
describe('close button click', () => {
|
||||
beforeEach(async () => {
|
||||
await wrapper.findAll('button').at(2).trigger('click')
|
||||
await wrapper.findAll('button').at(3).trigger('click')
|
||||
})
|
||||
|
||||
it('Shows the TransactionForm', () => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user