diff --git a/packages/web-pkg/tests/unit/components/AppTopBar.spec.ts b/packages/web-pkg/tests/unit/components/AppTopBar.spec.ts index 37c7321f4f1..af4398933f3 100644 --- a/packages/web-pkg/tests/unit/components/AppTopBar.spec.ts +++ b/packages/web-pkg/tests/unit/components/AppTopBar.spec.ts @@ -1,5 +1,10 @@ import { mock } from 'jest-mock-extended' -import { defaultPlugins, shallowMount } from 'web-test-helpers' +import { + createStore, + defaultPlugins, + defaultStoreMockOptions, + shallowMount +} from 'web-test-helpers' import { Resource } from '@ownclouders/web-client/src/helpers' import AppTopBar from '../../../src/components/AppTopBar.vue' import { Action } from '../../../src/composables/actions' @@ -7,27 +12,31 @@ import { Action } from '../../../src/composables/actions' describe('AppTopBar', () => { describe('if no resource is present', () => { it('renders only a close button', () => { - const { wrapper } = getWrapper() + const { wrapper } = getWrapper(mock({ path: '/test.txt' })) expect(wrapper.html()).toMatchSnapshot() }) }) describe('if a resource is present', () => { it('renders a resource and no actions (if none given) and a close button', () => { - const { wrapper } = getWrapper(mock()) + const { wrapper } = getWrapper(mock({ path: '/test.txt' })) expect(wrapper.html()).toMatchSnapshot() }) it('renders a resource and mainActions (if given) and a close button', () => { - const { wrapper } = getWrapper(mock(), [], [mock()]) + const { wrapper } = getWrapper(mock({ path: '/test.txt' }), [], [mock()]) expect(wrapper.html()).toMatchSnapshot() }) it('renders a resource and dropdownActions (if given) and a close button', () => { - const { wrapper } = getWrapper(mock(), [mock()], []) + const { wrapper } = getWrapper(mock({ path: '/test.txt' }), [mock()], []) expect(wrapper.html()).toMatchSnapshot() }) it('renders a resource and dropdownActions as well as mainActions (if both are passed) and a close button', () => { - const { wrapper } = getWrapper(mock(), [mock()], [mock()]) + const { wrapper } = getWrapper( + mock({ path: '/test.txt' }), + [mock()], + [mock()] + ) expect(wrapper.html()).toMatchSnapshot() }) }) @@ -38,6 +47,8 @@ function getWrapper( dropDownActions: Action[] = [], mainActions: Action[] = [] ) { + const storeOptions = { ...defaultStoreMockOptions } + const store = createStore(storeOptions) return { wrapper: shallowMount(AppTopBar, { props: { @@ -46,7 +57,7 @@ function getWrapper( resource }, global: { - plugins: [...defaultPlugins()] + plugins: [...defaultPlugins(), store] } }) } diff --git a/packages/web-pkg/tests/unit/components/__snapshots__/AppTopBar.spec.ts.snap b/packages/web-pkg/tests/unit/components/__snapshots__/AppTopBar.spec.ts.snap index 24b297c8f87..20cf37d8b6f 100644 --- a/packages/web-pkg/tests/unit/components/__snapshots__/AppTopBar.spec.ts.snap +++ b/packages/web-pkg/tests/unit/components/__snapshots__/AppTopBar.spec.ts.snap @@ -5,7 +5,7 @@ exports[`AppTopBar if a resource is present renders a resource and dropdownActio
- +
@@ -23,7 +23,7 @@ exports[`AppTopBar if a resource is present renders a resource and dropdownActio
- +
@@ -41,7 +41,7 @@ exports[`AppTopBar if a resource is present renders a resource and mainActions (
- +
@@ -58,7 +58,7 @@ exports[`AppTopBar if a resource is present renders a resource and no actions (i
- +
@@ -75,7 +75,7 @@ exports[`AppTopBar if no resource is present renders only a close button 1`] = `
- +