use router push to navigate to send

This commit is contained in:
Moriz Wahl 2022-03-21 21:43:23 +01:00
parent f0132593b8
commit 4621ee35d1
2 changed files with 17 additions and 7 deletions

View File

@ -3,7 +3,11 @@ import AmountAndNameRow from './AmountAndNameRow'
const localVue = global.localVue
const mocks = {}
const mocks = {
$router: {
push: jest.fn(),
},
}
const propsData = {
amount: '19.99',
@ -51,10 +55,17 @@ describe('AmountAndNameRow', () => {
expect(wrapper.find('div.gdd-transaction-list-item-name').find('a').exists()).toBe(true)
})
it('links with param email', () => {
expect(
wrapper.find('div.gdd-transaction-list-item-name').find('a').attributes('href'),
).toBe('/send?email=bibi@bloxberg.de')
describe('click link', () => {
beforeEach(async () => {
await wrapper.find('div.gdd-transaction-list-item-name').find('a').trigger('click')
})
it('pushes the rpute with query for email', () => {
expect(mocks.$router.push).toBeCalledWith({
path: '/send',
query: { email: 'bibi@bloxberg.de' },
})
})
})
})
})

View File

@ -12,8 +12,7 @@
<div class="gdd-transaction-list-item-name">
<b-link
v-if="linkedUser && linkedUser.email"
:href="`/send?email=${linkedUser.email}`"
@click.stop
@click.stop="$router.push({ path: '/send', query: { email: `${linkedUser.email}` } })"
>
{{ itemText }}
</b-link>