From ce3784ddbe741d763c605b87e1285a2d04081546 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Thu, 23 Mar 2023 13:13:57 +0100 Subject: [PATCH] tests for links with gradido ID --- .../components/TransactionRows/Name.spec.js | 20 ++++++++++++------- frontend/src/layouts/DashboardLayout.spec.js | 9 --------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/frontend/src/components/TransactionRows/Name.spec.js b/frontend/src/components/TransactionRows/Name.spec.js index 839a698ae..2c370bafc 100644 --- a/frontend/src/components/TransactionRows/Name.spec.js +++ b/frontend/src/components/TransactionRows/Name.spec.js @@ -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', + }, }) }) }) diff --git a/frontend/src/layouts/DashboardLayout.spec.js b/frontend/src/layouts/DashboardLayout.spec.js index 68fcb5ad5..9f68199da 100644 --- a/frontend/src/layouts/DashboardLayout.spec.js +++ b/frontend/src/layouts/DashboardLayout.spec.js @@ -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) })