Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JanAckermann committed Apr 7, 2022
1 parent 99aa3de commit ec7d9a2
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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')
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
29 changes: 16 additions & 13 deletions packages/web-app-user-management/tests/unit/views/Users.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@ describe('Users view', () => {
const wrapper = getMountedWrapper({
mocks: {
users: [user],
userAssignments: [
[
userAssignments: {
1: [
{
accountUuid: '1',
roleId: '1'
}
]
],
},
roles: [
{
displayName: 'admin',
Expand All @@ -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' }
Expand All @@ -127,14 +130,14 @@ describe('Users view', () => {
const wrapper = getMountedWrapper({
mocks: {
users: [user],
userAssignments: [
[
userAssignments: {
2: [
{
accountUuid: '2',
roleId: '1'
}
]
],
},
roles: [
{
displayName: 'admin',
Expand All @@ -150,14 +153,14 @@ describe('Users view', () => {
const wrapper = getMountedWrapper({
mocks: {
users: [user],
userAssignments: [
[
userAssignments: {
1: [
{
accountUuid: '1',
roleId: '1'
}
]
],
},
roles: [
{
displayName: 'admin',
Expand All @@ -173,13 +176,13 @@ describe('Users view', () => {
const wrapper = getMountedWrapper({
mocks: {
users: [user],
userAssignments: [
[
userAssignments: {
1: [
{
accountUuid: '1'
}
]
],
},
roles: [
{
displayName: 'admin',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

exports[`ApplicationsMenu component should render navigation with button and menu items in dropdown 1`] = `
<nav id="applications-menu" aria-label="Main navigation" class="oc-flex oc-flex-middle">
<oc-button-stub type="button" size="medium" arialabel="Application Switcher" submit="button" variation="inverse" appearance="raw" justifycontent="center" gapsize="medium" id="_appSwitcherButton" class="oc-topbar-menu-burger">
<oc-icon-stub name="grid" filltype="fill" accessiblelabel="" type="span" size="large" variation="passive" color="" class="oc-flex"></oc-icon-stub>
<oc-button-stub id="_appSwitcherButton" appearance="raw" variation="inverse" aria-label="Application Switcher" class="oc-topbar-menu-burger">
<oc-icon-stub name="grid" size="large" class="oc-flex"></oc-icon-stub>
</oc-button-stub>
<oc-drop-stub dropid="app-switcher-dropdown" toggle="#_appSwitcherButton" position="bottom-start" mode="click" closeonclick="true" paddingsize="small">
<oc-drop-stub drop-id="app-switcher-dropdown" toggle="#_appSwitcherButton" mode="click" padding-size="small" close-on-click="">
<oc-list-stub class="applications-list">
<li>
<oc-button-stub type="router-link" size="medium" to="/files" submit="button" variation="passive" appearance="raw" justifycontent="center" gapsize="medium" class=""><span class="icon-box"><oc-icon-stub name="folder" filltype="fill" accessiblelabel="" type="span" size="medium" variation="passive" color=""></oc-icon-stub></span> <span>Files</span>
<oc-button-stub type="router-link" to="/files" appearance="raw" variation="passive" class=""><span class="icon-box"><oc-icon-stub name="folder"></oc-icon-stub></span> <span>Files</span>
<!---->
</oc-button-stub>
</li>
<li>
<oc-button-stub type="a" size="medium" href="http://some.org" submit="button" variation="passive" appearance="raw" justifycontent="center" gapsize="medium" target="_blank" class=""><span class="icon-box"><oc-icon-stub name="some-icon" filltype="fill" accessiblelabel="" type="span" size="medium" variation="passive" color=""></oc-icon-stub></span> <span>External</span>
<oc-button-stub type="a" target="_blank" href="http://some.org" appearance="raw" variation="passive" class=""><span class="icon-box"><oc-icon-stub name="some-icon"></oc-icon-stub></span> <span>External</span>
<!---->
</oc-button-stub>
</li>
Expand Down

0 comments on commit ec7d9a2

Please sign in to comment.