tests for links with gradido ID

This commit is contained in:
Moriz Wahl 2023-03-23 13:13:57 +01:00
parent dec5a6f61f
commit ce3784ddbe
2 changed files with 13 additions and 16 deletions

View File

@ -3,9 +3,11 @@ import Name from './Name'
const localVue = global.localVue
const routerPushMock = jest.fn()
const mocks = {
$router: {
push: jest.fn(),
push: routerPushMock,
history: {
current: {
fullPath: '/transactions',
@ -47,7 +49,7 @@ describe('Name', () => {
describe('with linked user', () => {
beforeEach(async () => {
await wrapper.setProps({
linkedUser: { firstName: 'Bibi', lastName: 'Bloxberg', email: 'bibi@bloxberg.de' },
linkedUser: { firstName: 'Bibi', lastName: 'Bloxberg', gradidoID: 'gradido-ID' },
})
})
@ -64,13 +66,17 @@ describe('Name', () => {
await wrapper.find('div.gdd-transaction-list-item-name').find('a').trigger('click')
})
it('emits set tunneled email', () => {
expect(wrapper.emitted('set-tunneled-email')).toEqual([['bibi@bloxberg.de']])
it('pushes router to send', () => {
expect(routerPushMock).toBeCalledWith({
path: '/send',
})
})
it('pushes the route with query for email', () => {
expect(mocks.$router.push).toBeCalledWith({
path: '/send',
it('pushes query for gradidoID', () => {
expect(routerPushMock).toBeCalledWith({
query: {
gradidoID: 'gradido-ID',
},
})
})
})

View File

@ -174,15 +174,6 @@ describe('DashboardLayout', () => {
})
})
describe('set tunneled email', () => {
it('updates tunneled email', async () => {
await wrapper
.findComponent({ ref: 'router-view' })
.vm.$emit('set-tunneled-email', 'bibi@bloxberg.de')
expect(wrapper.vm.tunneledEmail).toBe('bibi@bloxberg.de')
})
})
it('has a component Navbar', () => {
expect(wrapper.findComponent({ name: 'Navbar' }).exists()).toBe(true)
})