From ec7d9a244d2a28c6ac7e6b37dc435ffdfb238aca Mon Sep 17 00:00:00 2001 From: JanAckermann Date: Thu, 7 Apr 2022 09:21:24 +0200 Subject: [PATCH] Fix tests --- .../Users/SideBar/DetailsPanel.spec.js | 5 +++- .../unit/components/Users/UsersList.spec.js | 2 +- .../tests/unit/views/Users.spec.js | 29 ++++++++++--------- .../ApplicationsMenu.spec.js.snap | 10 +++---- 4 files changed, 26 insertions(+), 20 deletions(-) diff --git a/packages/web-app-user-management/tests/unit/components/Users/SideBar/DetailsPanel.spec.js b/packages/web-app-user-management/tests/unit/components/Users/SideBar/DetailsPanel.spec.js index ebbf892ff0c..64f4e152520 100644 --- a/packages/web-app-user-management/tests/unit/components/Users/SideBar/DetailsPanel.spec.js +++ b/packages/web-app-user-management/tests/unit/components/Users/SideBar/DetailsPanel.spec.js @@ -66,7 +66,10 @@ describe('DetailsPanel', () => { }) it('should be set if user role is assigned', () => { const wrapper = getWrapper({ - propsData: { users: [{ id: '1', displayName: 'user' }], userRoles: { 1: 'admin' } } + propsData: { + users: [{ id: '1', displayName: 'user' }], + userRoles: { 1: { displayName: 'admin' } } + } }) expect(wrapper.vm.userRole).toEqual('admin') }) diff --git a/packages/web-app-user-management/tests/unit/components/Users/UsersList.spec.js b/packages/web-app-user-management/tests/unit/components/Users/UsersList.spec.js index a89f40232ce..a4935d6f977 100644 --- a/packages/web-app-user-management/tests/unit/components/Users/UsersList.spec.js +++ b/packages/web-app-user-management/tests/unit/components/Users/UsersList.spec.js @@ -33,7 +33,7 @@ describe('UsersList', () => { it('should return user role if record is set', () => { const wrapper = getWrapper({ propsData: { - userRoles: { 1: 'admin' } + userRoles: { 1: { displayName: 'admin' } } } }) expect(wrapper.vm.getUserRole({ id: 1 })).toEqual('admin') diff --git a/packages/web-app-user-management/tests/unit/views/Users.spec.js b/packages/web-app-user-management/tests/unit/views/Users.spec.js index 2e2f1884f16..9c42ec1bbed 100644 --- a/packages/web-app-user-management/tests/unit/views/Users.spec.js +++ b/packages/web-app-user-management/tests/unit/views/Users.spec.js @@ -97,14 +97,14 @@ describe('Users view', () => { const wrapper = getMountedWrapper({ mocks: { users: [user], - userAssignments: [ - [ + userAssignments: { + 1: [ { accountUuid: '1', roleId: '1' } ] - ], + }, roles: [ { displayName: 'admin', @@ -113,7 +113,10 @@ describe('Users view', () => { ] } }) - expect(wrapper.vm.userRoles[user.id]).toEqual('admin') + expect(wrapper.vm.userRoles[user.id]).toEqual({ + displayName: 'admin', + id: '1' + }) }) it('should not contain user role if userAssignments is empty', () => { const user = { id: '1' } @@ -127,14 +130,14 @@ describe('Users view', () => { const wrapper = getMountedWrapper({ mocks: { users: [user], - userAssignments: [ - [ + userAssignments: { + 2: [ { accountUuid: '2', roleId: '1' } ] - ], + }, roles: [ { displayName: 'admin', @@ -150,14 +153,14 @@ describe('Users view', () => { const wrapper = getMountedWrapper({ mocks: { users: [user], - userAssignments: [ - [ + userAssignments: { + 1: [ { accountUuid: '1', roleId: '1' } ] - ], + }, roles: [ { displayName: 'admin', @@ -173,13 +176,13 @@ describe('Users view', () => { const wrapper = getMountedWrapper({ mocks: { users: [user], - userAssignments: [ - [ + userAssignments: { + 1: [ { accountUuid: '1' } ] - ], + }, roles: [ { displayName: 'admin', diff --git a/packages/web-runtime/tests/unit/components/Topbar/__snapshots__/ApplicationsMenu.spec.js.snap b/packages/web-runtime/tests/unit/components/Topbar/__snapshots__/ApplicationsMenu.spec.js.snap index 1cd53adf2af..63da2736dc9 100644 --- a/packages/web-runtime/tests/unit/components/Topbar/__snapshots__/ApplicationsMenu.spec.js.snap +++ b/packages/web-runtime/tests/unit/components/Topbar/__snapshots__/ApplicationsMenu.spec.js.snap @@ -2,18 +2,18 @@ exports[`ApplicationsMenu component should render navigation with button and menu items in dropdown 1`] = `