From 3f7d46da1b487e30c233ce679e38ebf74e8cb82a Mon Sep 17 00:00:00 2001 From: Jannik Stehle Date: Tue, 15 Feb 2022 16:21:16 +0100 Subject: [PATCH] Add unit tests, adjust snapshots --- .../SideBar/Details/SpaceDetails.spec.js | 102 ++++++++++++++++ .../__snapshots__/SpaceDetails.spec.js.snap | 30 +++++ .../unit/components/SideBar/SpaceInfo.spec.js | 106 ++++++++++++++++ .../__snapshots__/SpaceInfo.spec.js.snap | 14 +++ .../tests/unit/mixins/spaces/delete.spec.js | 28 ++++- .../tests/unit/mixins/spaces/disable.spec.js | 115 ++++++++++++++++++ .../mixins/spaces/editDescription.spec.js | 93 ++++++++++++++ .../tests/unit/mixins/spaces/rename.spec.js | 9 +- .../tests/unit/mixins/spaces/restore.spec.js | 115 ++++++++++++++++++ .../unit/mixins/spaces/showDetails.spec.js | 70 +++++++++++ .../__snapshots__/Projects.spec.js.snap | 7 +- .../__snapshots__/UserMenu.spec.js.snap | 12 +- tests/unit/stubs/index.js | 3 +- 13 files changed, 695 insertions(+), 9 deletions(-) create mode 100644 packages/web-app-files/tests/unit/components/SideBar/Details/SpaceDetails.spec.js create mode 100644 packages/web-app-files/tests/unit/components/SideBar/Details/__snapshots__/SpaceDetails.spec.js.snap create mode 100644 packages/web-app-files/tests/unit/components/SideBar/SpaceInfo.spec.js create mode 100644 packages/web-app-files/tests/unit/components/SideBar/__snapshots__/SpaceInfo.spec.js.snap create mode 100644 packages/web-app-files/tests/unit/mixins/spaces/disable.spec.js create mode 100644 packages/web-app-files/tests/unit/mixins/spaces/editDescription.spec.js create mode 100644 packages/web-app-files/tests/unit/mixins/spaces/restore.spec.js create mode 100644 packages/web-app-files/tests/unit/mixins/spaces/showDetails.spec.js diff --git a/packages/web-app-files/tests/unit/components/SideBar/Details/SpaceDetails.spec.js b/packages/web-app-files/tests/unit/components/SideBar/Details/SpaceDetails.spec.js new file mode 100644 index 00000000000..a1dfa2e7670 --- /dev/null +++ b/packages/web-app-files/tests/unit/components/SideBar/Details/SpaceDetails.spec.js @@ -0,0 +1,102 @@ +import { createLocalVue, shallowMount } from '@vue/test-utils' +import Vuex from 'vuex' +import SpaceDetails from '../../../../../src/components/SideBar/Details/SpaceDetails.vue' +import stubs from '../../../../../../../tests/unit/stubs' +import GetTextPlugin from 'vue-gettext' +import AsyncComputed from 'vue-async-computed' +import VueCompositionAPI from '@vue/composition-api/dist/vue-composition-api' + +const localVue = createLocalVue() +localVue.use(Vuex) +localVue.use(AsyncComputed) +localVue.use(VueCompositionAPI) +localVue.use(GetTextPlugin, { + translations: 'does-not-matter.json', + silent: true +}) +const OcTooltip = jest.fn() + +const spaceMock = { + type: 'space', + name: ' space', + id: '1', + mdate: 'Wed, 21 Oct 2015 07:28:00 GMT', + spaceQuota: { + used: 100, + total: 1000 + } +} + +const formDateFromJSDate = jest.fn().mockImplementation(() => 'ABSOLUTE_TIME') +const formDateFromHTTP = jest.fn().mockImplementation(() => 'ABSOLUTE_TIME') +const refreshShareDetailsTree = jest.fn() +beforeEach(() => { + formDateFromJSDate.mockClear() + formDateFromHTTP.mockClear() + refreshShareDetailsTree.mockReset() +}) + +describe('Details SideBar Panel', () => { + it('displayes the details side panel', () => { + const wrapper = createWrapper(spaceMock) + expect(wrapper).toMatchSnapshot() + }) +}) + +function createWrapper(spaceResource) { + const component = { + ...SpaceDetails, + setup: () => ({ + spaceImage: '', + owners: [], + loadImageTask: { + isRunning: false, + perform: jest.fn() + }, + loadOwnersTask: { + isRunning: false, + perform: jest.fn() + } + }) + } + return shallowMount(component, { + store: new Vuex.Store({ + getters: { + user: function () { + return { id: 'marie' } + } + }, + modules: { + Files: { + namespaced: true, + state: { + sharesTree: {} + }, + getters: { + highlightedFile: function () { + return spaceResource + } + } + } + } + }), + localVue, + stubs: stubs, + directives: { + OcTooltip + }, + mixins: [ + { + methods: { + formDateFromJSDate, + formDateFromHTTP + } + } + ], + provide: { + displayedItem: { + value: spaceResource + } + } + }) +} diff --git a/packages/web-app-files/tests/unit/components/SideBar/Details/__snapshots__/SpaceDetails.spec.js.snap b/packages/web-app-files/tests/unit/components/SideBar/Details/__snapshots__/SpaceDetails.spec.js.snap new file mode 100644 index 00000000000..e982eff6dbc --- /dev/null +++ b/packages/web-app-files/tests/unit/components/SideBar/Details/__snapshots__/SpaceDetails.spec.js.snap @@ -0,0 +1,30 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Details SideBar Panel displayes the details side panel 1`] = ` +
+
+ +
+ +
+ + + + + + + + + + + + + + +
Last activityInvalid DateTime
Manager
Quota +

10.00 % full (100 B of 1 kB used)

+ +
+
+
+`; diff --git a/packages/web-app-files/tests/unit/components/SideBar/SpaceInfo.spec.js b/packages/web-app-files/tests/unit/components/SideBar/SpaceInfo.spec.js new file mode 100644 index 00000000000..511a22eb235 --- /dev/null +++ b/packages/web-app-files/tests/unit/components/SideBar/SpaceInfo.spec.js @@ -0,0 +1,106 @@ +import { shallowMount, createLocalVue } from '@vue/test-utils' +import Vuex from 'vuex' +import GetTextPlugin from 'vue-gettext' +import AsyncComputed from 'vue-async-computed' + +import stubs from '@/tests/unit/stubs' + +import SpaceInfo from '@files/src/components/SideBar/SpaceInfo.vue' + +const spaceMock = { + type: 'space', + name: ' space', + id: '1', + mdate: 'Wed, 21 Oct 2015 07:28:00 GMT', + spaceQuota: { + used: 100 + } +} + +const localVue = createLocalVue() +localVue.use(Vuex) +localVue.use(AsyncComputed) +localVue.use(GetTextPlugin, { + translations: 'does-not-matter.json', + silent: true +}) + +const selectors = { + name: '[data-testid="space-info-name"]', + subtitle: '[data-testid="space-info-subtitle"]' +} + +const formDateFromRFC = jest.fn() +const formRelativeDateFromRFC = jest.fn() +const resetDateMocks = () => { + formDateFromRFC.mockReset() + formRelativeDateFromRFC.mockReset() + formDateFromRFC.mockImplementation(() => 'ABSOLUTE_TIME') + formRelativeDateFromRFC.mockImplementation(() => 'RELATIVE_TIME') +} + +describe('SpaceInfo', () => { + it('shows space info', () => { + resetDateMocks() + + const wrapper = createWrapper(spaceMock) + expect(wrapper.find(selectors.name).exists()).toBeTruthy() + expect(wrapper.find(selectors.subtitle).exists()).toBeTruthy() + expect(wrapper).toMatchSnapshot() + }) +}) + +function createWrapper(spaceResource) { + return shallowMount(SpaceInfo, { + store: new Vuex.Store({ + getters: { + user: function () { + return { id: 'marie' } + }, + capabilities: jest.fn(() => ({})) + }, + modules: { + Files: { + namespaced: true, + getters: { + highlightedFile: function () { + return spaceResource + } + } + } + } + }), + localVue, + stubs: { + ...stubs, + 'oc-resource-icon': true, + 'oc-resource-name': true + }, + directives: { + OcTooltip: null + }, + mixins: [ + { + methods: { + formDateFromRFC, + formRelativeDateFromRFC + } + } + ], + mocks: { + $router: { + currentRoute: { + name: 'some-route', + query: { page: 1 } + }, + resolve: (r) => ({ href: r.name }) + }, + publicPage: () => false + }, + provide: { + displayedItem: { + value: spaceResource + } + } + }) +} diff --git a/packages/web-app-files/tests/unit/components/SideBar/__snapshots__/SpaceInfo.spec.js.snap b/packages/web-app-files/tests/unit/components/SideBar/__snapshots__/SpaceInfo.spec.js.snap new file mode 100644 index 00000000000..ace235d86dc --- /dev/null +++ b/packages/web-app-files/tests/unit/components/SideBar/__snapshots__/SpaceInfo.spec.js.snap @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`SpaceInfo shows space info 1`] = ` +
+
+
+ +
+
+

space

+
+
+
+`; diff --git a/packages/web-app-files/tests/unit/mixins/spaces/delete.spec.js b/packages/web-app-files/tests/unit/mixins/spaces/delete.spec.js index 9a2a33eae2a..08657a68a7e 100644 --- a/packages/web-app-files/tests/unit/mixins/spaces/delete.spec.js +++ b/packages/web-app-files/tests/unit/mixins/spaces/delete.spec.js @@ -50,14 +50,40 @@ describe('delete', () => { }) } + describe('isEnabled property', () => { + it('should be false when not resource given', () => { + const wrapper = getWrapper() + expect(wrapper.vm.$_delete_items[0].isEnabled({ resources: [] })).toBe(false) + }) + it('should be false when the space is not disabled', () => { + const wrapper = getWrapper() + expect( + wrapper.vm.$_delete_items[0].isEnabled({ resources: [{ id: 1, disabled: false }] }) + ).toBe(false) + }) + it('should be true when the space is disabled', () => { + const wrapper = getWrapper() + expect( + wrapper.vm.$_delete_items[0].isEnabled({ resources: [{ id: 1, disabled: true }] }) + ).toBe(true) + }) + }) + describe('method "$_delete_trigger"', () => { it('should trigger the delete modal window', async () => { const wrapper = getWrapper() const spyCreateModalStub = jest.spyOn(wrapper.vm, 'createModal') - await wrapper.vm.$_delete_trigger({ spaces: [{ id: 1 }] }) + await wrapper.vm.$_delete_trigger({ resources: [{ id: 1 }] }) expect(spyCreateModalStub).toHaveBeenCalledTimes(1) }) + it('should not trigger the delete modal window without any resource', async () => { + const wrapper = getWrapper() + const spyCreateModalStub = jest.spyOn(wrapper.vm, 'createModal') + await wrapper.vm.$_delete_trigger({ resources: [] }) + + expect(spyCreateModalStub).toHaveBeenCalledTimes(0) + }) }) describe('method "$_delete_deleteSpace"', () => { diff --git a/packages/web-app-files/tests/unit/mixins/spaces/disable.spec.js b/packages/web-app-files/tests/unit/mixins/spaces/disable.spec.js new file mode 100644 index 00000000000..d23eaef8f1c --- /dev/null +++ b/packages/web-app-files/tests/unit/mixins/spaces/disable.spec.js @@ -0,0 +1,115 @@ +import Vuex from 'vuex' +import { createStore } from 'vuex-extensions' +import { mount, createLocalVue } from '@vue/test-utils' +import disable from '@files/src/mixins/spaces/actions/disable.js' +import { createLocationSpaces } from '../../../../src/router' +import mockAxios from 'jest-mock-axios' + +const localVue = createLocalVue() +localVue.use(Vuex) + +describe('disable', () => { + const Component = { + render() {}, + mixins: [disable] + } + + function getWrapper() { + return mount(Component, { + localVue, + mocks: { + $router: { + currentRoute: createLocationSpaces('files-spaces-projects'), + resolve: (r) => { + return { href: r.name } + } + }, + $gettext: jest.fn() + }, + store: createStore(Vuex.Store, { + actions: { + createModal: jest.fn(), + hideModal: jest.fn(), + showMessage: jest.fn(), + setModalInputErrorMessage: jest.fn() + }, + getters: { + configuration: () => ({ + server: 'https://example.com' + }), + getToken: () => 'token' + }, + modules: { + Files: { + namespaced: true, + mutations: { + UPDATE_RESOURCE_FIELD: jest.fn() + } + } + } + }) + }) + } + + describe('isEnabled property', () => { + it('should be false when no resource given', () => { + const wrapper = getWrapper() + expect(wrapper.vm.$_disable_items[0].isEnabled({ resources: [] })).toBe(false) + }) + it('should be true when the space is not disabled', () => { + const wrapper = getWrapper() + expect( + wrapper.vm.$_disable_items[0].isEnabled({ resources: [{ id: 1, disabled: false }] }) + ).toBe(true) + }) + it('should be false when the space is disabled', () => { + const wrapper = getWrapper() + expect( + wrapper.vm.$_disable_items[0].isEnabled({ resources: [{ id: 1, disabled: true }] }) + ).toBe(false) + }) + }) + + describe('method "$_disable_trigger"', () => { + it('should trigger the disable modal window', async () => { + const wrapper = getWrapper() + const spyCreateModalStub = jest.spyOn(wrapper.vm, 'createModal') + await wrapper.vm.$_disable_trigger({ resources: [{ id: 1 }] }) + + expect(spyCreateModalStub).toHaveBeenCalledTimes(1) + }) + it('should not trigger the disable modal window without any resource', async () => { + const wrapper = getWrapper() + const spyCreateModalStub = jest.spyOn(wrapper.vm, 'createModal') + await wrapper.vm.$_disable_trigger({ resources: [] }) + + expect(spyCreateModalStub).toHaveBeenCalledTimes(0) + }) + }) + + describe('method "$_disable_disableSpace"', () => { + it('should hide the modal on success', async () => { + mockAxios.request.mockImplementationOnce(() => { + return Promise.resolve() + }) + + const wrapper = getWrapper() + const hideModalStub = jest.spyOn(wrapper.vm, 'hideModal') + await wrapper.vm.$_disable_disableSpace(1) + + expect(hideModalStub).toHaveBeenCalledTimes(1) + }) + + it('should show message on error', async () => { + mockAxios.request.mockImplementationOnce(() => { + return Promise.reject(new Error()) + }) + + const wrapper = getWrapper() + const showMessageStub = jest.spyOn(wrapper.vm, 'showMessage') + await wrapper.vm.$_disable_disableSpace(1) + + expect(showMessageStub).toHaveBeenCalledTimes(1) + }) + }) +}) diff --git a/packages/web-app-files/tests/unit/mixins/spaces/editDescription.spec.js b/packages/web-app-files/tests/unit/mixins/spaces/editDescription.spec.js new file mode 100644 index 00000000000..37317b9fd3f --- /dev/null +++ b/packages/web-app-files/tests/unit/mixins/spaces/editDescription.spec.js @@ -0,0 +1,93 @@ +import Vuex from 'vuex' +import { createStore } from 'vuex-extensions' +import { mount, createLocalVue } from '@vue/test-utils' +import EditDescription from '@files/src/mixins/spaces/actions/editDescription.js' +import { createLocationSpaces } from '../../../../src/router' +import mockAxios from 'jest-mock-axios' + +const localVue = createLocalVue() +localVue.use(Vuex) + +describe('editDescription', () => { + const Component = { + render() {}, + mixins: [EditDescription] + } + + function getWrapper() { + return mount(Component, { + localVue, + mocks: { + $router: { + currentRoute: createLocationSpaces('files-spaces-projects'), + resolve: (r) => { + return { href: r.name } + } + }, + $gettext: jest.fn() + }, + store: createStore(Vuex.Store, { + actions: { + createModal: jest.fn(), + hideModal: jest.fn(), + showMessage: jest.fn() + }, + getters: { + configuration: () => ({ + server: 'https://example.com' + }), + getToken: () => 'token' + }, + modules: { + Files: { + namespaced: true, + mutations: { + UPDATE_RESOURCE_FIELD: jest.fn() + } + } + } + }) + }) + } + + describe('method "$_editDescription_trigger"', () => { + it('should trigger the editDescription modal window with one resource', async () => { + const wrapper = getWrapper() + const spyCreateModalStub = jest.spyOn(wrapper.vm, 'createModal') + await wrapper.vm.$_editDescription_trigger({ resources: [{ id: 1 }] }) + + expect(spyCreateModalStub).toHaveBeenCalledTimes(1) + }) + it('should not trigger the editDescription modal window with no resource', async () => { + const wrapper = getWrapper() + const spyCreateModalStub = jest.spyOn(wrapper.vm, 'createModal') + await wrapper.vm.$_editDescription_trigger({ resources: [] }) + + expect(spyCreateModalStub).toHaveBeenCalledTimes(0) + }) + }) + + describe('method "$_editDescription_editDescriptionSpace"', () => { + it('should hide the modal on success', async () => { + mockAxios.request.mockImplementationOnce(() => { + return Promise.resolve() + }) + const wrapper = getWrapper() + const hideModalStub = jest.spyOn(wrapper.vm, 'hideModal') + await wrapper.vm.$_editDescription_editDescriptionSpace(1) + + expect(hideModalStub).toHaveBeenCalledTimes(1) + }) + + it('should show message on error', async () => { + mockAxios.request.mockImplementationOnce(() => { + return Promise.reject(new Error()) + }) + const wrapper = getWrapper() + const showMessageStub = jest.spyOn(wrapper.vm, 'showMessage') + await wrapper.vm.$_editDescription_editDescriptionSpace(1) + + expect(showMessageStub).toHaveBeenCalledTimes(1) + }) + }) +}) diff --git a/packages/web-app-files/tests/unit/mixins/spaces/rename.spec.js b/packages/web-app-files/tests/unit/mixins/spaces/rename.spec.js index d052a5e1b26..2b1e4b8822d 100644 --- a/packages/web-app-files/tests/unit/mixins/spaces/rename.spec.js +++ b/packages/web-app-files/tests/unit/mixins/spaces/rename.spec.js @@ -55,10 +55,17 @@ describe('rename', () => { it('should trigger the rename modal window', async () => { const wrapper = getWrapper() const spyCreateModalStub = jest.spyOn(wrapper.vm, 'createModal') - await wrapper.vm.$_rename_trigger({ spaces: [{ id: 1, name: 'renamed space' }] }) + await wrapper.vm.$_rename_trigger({ resources: [{ id: 1, name: 'renamed space' }] }) expect(spyCreateModalStub).toHaveBeenCalledTimes(1) }) + it('should not trigger the rename modal window without any resource', async () => { + const wrapper = getWrapper() + const spyCreateModalStub = jest.spyOn(wrapper.vm, 'createModal') + await wrapper.vm.$_rename_trigger({ resources: [] }) + + expect(spyCreateModalStub).toHaveBeenCalledTimes(0) + }) }) describe('method "$_rename_checkName"', () => { diff --git a/packages/web-app-files/tests/unit/mixins/spaces/restore.spec.js b/packages/web-app-files/tests/unit/mixins/spaces/restore.spec.js new file mode 100644 index 00000000000..484fcaec5d5 --- /dev/null +++ b/packages/web-app-files/tests/unit/mixins/spaces/restore.spec.js @@ -0,0 +1,115 @@ +import Vuex from 'vuex' +import { createStore } from 'vuex-extensions' +import { mount, createLocalVue } from '@vue/test-utils' +import restore from '@files/src/mixins/spaces/actions/restore.js' +import { createLocationSpaces } from '../../../../src/router' +import mockAxios from 'jest-mock-axios' + +const localVue = createLocalVue() +localVue.use(Vuex) + +describe('restore', () => { + const Component = { + render() {}, + mixins: [restore] + } + + function getWrapper() { + return mount(Component, { + localVue, + mocks: { + $router: { + currentRoute: createLocationSpaces('files-spaces-projects'), + resolve: (r) => { + return { href: r.name } + } + }, + $gettext: jest.fn() + }, + store: createStore(Vuex.Store, { + actions: { + createModal: jest.fn(), + hideModal: jest.fn(), + showMessage: jest.fn(), + setModalInputErrorMessage: jest.fn() + }, + getters: { + configuration: () => ({ + server: 'https://example.com' + }), + getToken: () => 'token' + }, + modules: { + Files: { + namespaced: true, + mutations: { + UPDATE_RESOURCE_FIELD: jest.fn() + } + } + } + }) + }) + } + + describe('isEnabled property', () => { + it('should be false when no resource given', () => { + const wrapper = getWrapper() + expect(wrapper.vm.$_restore_items[0].isEnabled({ resources: [] })).toBe(false) + }) + it('should be false when the space is not disabled', () => { + const wrapper = getWrapper() + expect( + wrapper.vm.$_restore_items[0].isEnabled({ resources: [{ id: 1, disabled: false }] }) + ).toBe(false) + }) + it('should be true when the space is disabled', () => { + const wrapper = getWrapper() + expect( + wrapper.vm.$_restore_items[0].isEnabled({ resources: [{ id: 1, disabled: true }] }) + ).toBe(true) + }) + }) + + describe('method "$_restore_trigger"', () => { + it('should trigger the restore modal window', async () => { + const wrapper = getWrapper() + const spyCreateModalStub = jest.spyOn(wrapper.vm, 'createModal') + await wrapper.vm.$_restore_trigger({ resources: [{ id: 1 }] }) + + expect(spyCreateModalStub).toHaveBeenCalledTimes(1) + }) + it('should not trigger the restore modal window without any resource', async () => { + const wrapper = getWrapper() + const spyCreateModalStub = jest.spyOn(wrapper.vm, 'createModal') + await wrapper.vm.$_restore_trigger({ resources: [] }) + + expect(spyCreateModalStub).toHaveBeenCalledTimes(0) + }) + }) + + describe('method "$_restore_restoreSpace"', () => { + it('should hide the modal on success', async () => { + mockAxios.request.mockImplementationOnce(() => { + return Promise.resolve() + }) + + const wrapper = getWrapper() + const hideModalStub = jest.spyOn(wrapper.vm, 'hideModal') + await wrapper.vm.$_restore_restoreSpace(1, 'renamed space') + + expect(hideModalStub).toHaveBeenCalledTimes(1) + }) + + it('should show message on error', async () => { + mockAxios.request.mockImplementationOnce(() => { + return Promise.reject(new Error()) + }) + + const wrapper = getWrapper() + const showMessageStub = jest.spyOn(wrapper.vm, 'showMessage') + await wrapper.vm.$_restore_restoreSpace(1) + + expect(showMessageStub).toHaveBeenCalledTimes(1) + }) + }) +}) diff --git a/packages/web-app-files/tests/unit/mixins/spaces/showDetails.spec.js b/packages/web-app-files/tests/unit/mixins/spaces/showDetails.spec.js new file mode 100644 index 00000000000..2faa986bcb7 --- /dev/null +++ b/packages/web-app-files/tests/unit/mixins/spaces/showDetails.spec.js @@ -0,0 +1,70 @@ +import Vuex from 'vuex' +import { createStore } from 'vuex-extensions' +import { mount, createLocalVue } from '@vue/test-utils' +import ShowDetails from '@files/src/mixins/spaces/actions/showDetails.js' +import { createLocationSpaces } from '../../../../src/router' + +const localVue = createLocalVue() +localVue.use(Vuex) + +describe('showDetails', () => { + const Component = { + render() {}, + mixins: [ShowDetails] + } + + function getWrapper() { + return mount(Component, { + localVue, + mocks: { + $router: { + currentRoute: createLocationSpaces('files-spaces-projects'), + resolve: (r) => { + return { href: r.name } + } + }, + $gettext: jest.fn() + }, + store: createStore(Vuex.Store, { + modules: { + Files: { + namespaced: true, + mutations: { + SET_FILE_SELECTION: jest.fn() + }, + modules: { + sidebar: { + namespaced: true, + actions: { + close: jest.fn(), + open: jest.fn() + } + } + } + } + } + }) + }) + } + + describe('method "$_showDetails_trigger"', () => { + it('should trigger the sidebar for one resource', async () => { + const wrapper = getWrapper() + const setSelectionStub = jest.spyOn(wrapper.vm, 'SET_FILE_SELECTION') + const openSidebarStub = jest.spyOn(wrapper.vm, 'openSidebar') + await wrapper.vm.$_showDetails_trigger({ resources: [{ id: 1 }] }) + + expect(setSelectionStub).toHaveBeenCalledTimes(1) + expect(openSidebarStub).toHaveBeenCalledTimes(1) + }) + it('should not trigger the sidebar without any resource', async () => { + const wrapper = getWrapper() + const setSelectionStub = jest.spyOn(wrapper.vm, 'SET_FILE_SELECTION') + const openSidebarStub = jest.spyOn(wrapper.vm, 'openSidebar') + await wrapper.vm.$_showDetails_trigger({ resources: [] }) + + expect(setSelectionStub).toHaveBeenCalledTimes(0) + expect(openSidebarStub).toHaveBeenCalledTimes(0) + }) + }) +}) diff --git a/packages/web-app-files/tests/unit/views/spaces/__snapshots__/Projects.spec.js.snap b/packages/web-app-files/tests/unit/views/spaces/__snapshots__/Projects.spec.js.snap index 94c49e2c834..a02fb2060fd 100644 --- a/packages/web-app-files/tests/unit/views/spaces/__snapshots__/Projects.spec.js.snap +++ b/packages/web-app-files/tests/unit/views/spaces/__snapshots__/Projects.spec.js.snap @@ -27,12 +27,15 @@ exports[`Spaces component should list spaces 1`] = `
    -
  • -
  • +
diff --git a/packages/web-runtime/tests/unit/components/Topbar/__snapshots__/UserMenu.spec.js.snap b/packages/web-runtime/tests/unit/components/Topbar/__snapshots__/UserMenu.spec.js.snap index cf3998fea82..88547f37df8 100644 --- a/packages/web-runtime/tests/unit/components/Topbar/__snapshots__/UserMenu.spec.js.snap +++ b/packages/web-runtime/tests/unit/components/Topbar/__snapshots__/UserMenu.spec.js.snap @@ -29,7 +29,8 @@ exports[`User Menu component when basic quota is set renders a danger quota prog
  • -

    Personal storage (91.0% used)
    910 B of 1 kB used

    +

    Personal storage (91.0% used)
    910 B of 1 kB used

    +
  • @@ -130,7 +131,8 @@ exports[`User Menu component when quota and no email is set renders a navigation
  • -

    Personal storage (30.0% used)
    300 B of 1 kB used

    +

    Personal storage (30.0% used)
    300 B of 1 kB used

    +
  • @@ -167,7 +169,8 @@ exports[`User Menu component when quota is above 80% and below 90% renders a war
  • -

    Personal storage (81.0% used)
    810 B of 1 kB used

    +

    Personal storage (81.0% used)
    810 B of 1 kB used

    +
  • @@ -204,7 +207,8 @@ exports[`User Menu component when quota is below 80% renders a primary quota pro
  • -

    Personal storage (30.0% used)
    300 B of 1 kB used

    +

    Personal storage (30.0% used)
    300 B of 1 kB used

    +
  • diff --git a/tests/unit/stubs/index.js b/tests/unit/stubs/index.js index bf488c93235..af6f74c8983 100644 --- a/tests/unit/stubs/index.js +++ b/tests/unit/stubs/index.js @@ -15,5 +15,6 @@ export default { 'oc-img': true, 'oc-page-size': true, 'router-link': true, - 'portal-target': true + 'portal-target': true, + 'oc-progress': true }