Skip to content

Commit

Permalink
Add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JanAckermann committed Apr 5, 2022
1 parent ee540ca commit eb099ec
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions packages/web-app-user-management/tests/unit/views/Users.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,39 @@ describe('Users view', () => {
expect(wrapper.vm.allUsersSelected).toBeFalsy()
})
})

describe('computed method "userRoles"', () => {
it('should contain user role if record exists in userAssignments', () => {
const user = { id: '1' }
const wrapper = getMountedWrapper({
mocks: {
users: [user],
userAssignments: [
[
{
accountUuid: '1',
roleId: '1'
}
]
],
roles: [
{
displayName: 'admin',
id: '1'
}
]
}
})
expect(wrapper.vm.userRoles[user.id]).toEqual('admin')
})
it('should not contain user role if record does not exist in userAssignments', () => {
const user = { id: '1' }
const wrapper = getMountedWrapper({
mocks: { users: [user], userAssignments: [] }
})
expect(user.id in wrapper.vm.userRoles).toBeFalsy()
})
})
})

function getMountedWrapper({
Expand Down

0 comments on commit eb099ec

Please sign in to comment.