Skip to content

Commit

Permalink
Fix unittests
Browse files Browse the repository at this point in the history
  • Loading branch information
lookacat committed Feb 13, 2023
1 parent 19fc70e commit 2063b9d
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ describe('Spaces view', () => {
expect(wrapper.find(selectors.noContentMessageStub).exists()).toBeTruthy()
})
describe('toggle selection', () => {
fdescribe('toggleSelectAllSpaces method', () => {
fit('selects all spaces', async () => {
describe('toggleSelectAllSpaces method', () => {
it('selects all spaces', async () => {
const spaces = [{ name: 'Some Space' }]
const { wrapper } = getWrapper({ spaces })
await wrapper.vm.loadResourcesTask.last
Expand Down
11 changes: 7 additions & 4 deletions packages/web-app-admin-settings/tests/unit/views/Users.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
import { AxiosResponse } from 'axios'
import { queryItemAsString } from 'web-pkg'

const mixins = ['$_editQuota_items']
const mixins = ['$_delete_items', '$_editQuota_items']
jest.mock('web-pkg/src/composables/appDefaults')

const getDefaultUser = () => {
Expand Down Expand Up @@ -325,11 +325,11 @@ describe('Users view', () => {
expect(wrapper.find('batch-actions-stub').exists()).toBeTruthy()
})
it('display when more than one users selected', async () => {
/*const { wrapper } = getMountedWrapper({ mountType: mount })
const { wrapper } = getMountedWrapper({ mountType: mount })
await wrapper.vm.loadResourcesTask.last
wrapper.vm.toggleSelectAllUsers()
await wrapper.vm.$nextTick()
expect(wrapper.find('batch-actions-stub').exists()).toBeTruthy()*/
expect(wrapper.find('batch-actions-stub').exists()).toBeTruthy()
})
})

Expand Down Expand Up @@ -399,11 +399,14 @@ function getMountedWrapper({
CreateUserModal: true,
AppLoadingSpinner: true,
OcBreadcrumb: true,
NoContentMessage: true,
OcTable: true,
ItemFilter: true,
BatchActions: true

}
}
})
}
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ function getWrapper(space) {
},
global: {
mocks: {
...defaultComponentMocks({ currentRoute: mock<RouteLocation>({ path: '/files' }) })
...defaultComponentMocks({ currentRoute: mock<RouteLocation>({ path: '/files' }) }),
$permissionManager: {
canEditSpaceQuota: () => true
}
},
plugins: [...defaultPlugins(), store]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,19 @@ exports[`SpaceContextActions action handlers renders actions that are always ava
</button>
</li>
</ul>
<ul class="oc-list oc-my-rm oc-mx-rm oc-files-context-actions oc-pb-s oc-pt-s oc-files-context-actions-border" id="oc-files-context-actions-secondaryActions">
<li class="context-menu oc-files-context-action oc-px-s oc-rounded oc-menu-item-hover">
<button class="oc-button oc-rounded oc-button-s oc-button-justify-content-center oc-button-gap-m oc-button-passive oc-button-passive-raw oc-files-actions-edit-quota-trigger action-menu-item" type="button">
<!-- @slot Content of the button -->
<span class="oc-icon oc-icon-m oc-icon-passive">
<!---->
</span>
<span class="oc-files-context-action-label">Edit quota</span>
<!--v-if-->
<!--v-if-->
</button>
</li>
</ul>
<ul class="oc-list oc-my-rm oc-mx-rm oc-files-context-actions oc-pb-s oc-pt-s oc-files-context-actions-border" id="oc-files-context-actions-trashBin">
<li class="context-menu oc-files-context-action oc-px-s oc-rounded oc-menu-item-hover">
<button class="oc-button oc-rounded oc-button-s oc-button-justify-content-left oc-button-gap-m oc-button-passive oc-button-passive-raw oc-files-actions-delete-trigger action-menu-item oc-py-s oc-px-m oc-width-1-1" type="button">
Expand Down
26 changes: 17 additions & 9 deletions packages/web-pkg/tests/unit/components/Spaces/QuotaModal.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,27 @@ function getWrapper(graphMock) {
},
props: {
cancel: jest.fn(),
space: {
id: '1fe58d8b-aa69-4c22-baf7-97dd57479f22',
spaceQuota: {
remaining: 9999999836,
state: 'normal',
total: 10000000000,
used: 164
spaces: [
{
id: '1fe58d8b-aa69-4c22-baf7-97dd57479f22',
spaceQuota: {
remaining: 9999999836,
state: 'normal',
total: 10000000000,
used: 164
}
}
}
]
},
global: {
stubs: { ...defaultStubs, portal: true, 'oc-modal': true },
mocks: { ...defaultComponentMocks(), $clientService },
mocks: {
...defaultComponentMocks(),
$clientService,
$permissionManager: {
canEditSpaceQuota: () => true
}
},
plugins: [...defaultPlugins(), store]
}
})
Expand Down

0 comments on commit 2063b9d

Please sign in to comment.