Skip to content

Commit df7fbe8

Browse files
author
Jannik Stehle
committed
fix(types): router types in tests
1 parent 735b6ea commit df7fbe8

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

packages/web-app-files/tests/unit/components/FilesList/NotFoundMessage.spec.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { MockProxy, mock } from 'vitest-mock-extended'
44
import { join } from 'path'
55
import { defaultComponentMocks, defaultPlugins, shallowMount } from 'web-test-helpers'
66
import { OcButton } from 'design-system/src/components'
7-
import { RouteLocationNormalizedLoaded } from 'vue-router'
7+
import { RouteLocationNamedRaw, RouteLocationNormalizedLoaded } from 'vue-router'
88

99
const selectors = {
1010
homeButton: '#files-list-not-found-button-go-home',
@@ -43,8 +43,9 @@ describe('NotFoundMessage', () => {
4343
const { wrapper } = getWrapper(space, spacesLocation)
4444
const homeButton = wrapper.findComponent<typeof OcButton>(selectors.homeButton)
4545

46-
expect(homeButton.props().to.name).toBe(spacesLocation.name)
47-
expect(homeButton.props().to.params.driveAliasAndItem).toBe('personal')
46+
const routeLocation = homeButton.props('to') as RouteLocationNamedRaw
47+
expect(routeLocation.name).toBe(spacesLocation.name)
48+
expect(routeLocation.params.driveAliasAndItem).toBe('personal')
4849
})
4950
})
5051

@@ -79,8 +80,9 @@ describe('NotFoundMessage', () => {
7980
const { wrapper } = getWrapper(space, publicLocation)
8081
const reloadLinkButton = wrapper.findComponent<typeof OcButton>(selectors.reloadLinkButton)
8182

82-
expect(reloadLinkButton.props().to.name).toBe(publicLocation.name)
83-
expect(reloadLinkButton.props().to.params.driveAliasAndItem).toBe(
83+
const routeLocation = reloadLinkButton.props('to') as RouteLocationNamedRaw
84+
expect(routeLocation.name).toBe(publicLocation.name)
85+
expect(routeLocation.params.driveAliasAndItem).toBe(
8486
space.getDriveAliasAndItem({ path: '' } as Resource)
8587
)
8688
})

packages/web-app-files/tests/unit/components/SideBar/Shares/Links/DetailsAndEdit.spec.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
import { SharingLinkType } from '@ownclouders/web-client/graph/generated'
1818
import { Resource } from '@ownclouders/web-client'
1919
import OcButton from 'design-system/src/components/OcButton/OcButton.vue'
20+
import { RouteLocationNamedRaw } from 'vue-router'
2021

2122
vi.mock('@ownclouders/web-pkg', async (importOriginal) => ({
2223
...(await importOriginal<any>()),
@@ -81,7 +82,8 @@ describe('DetailsAndEdit component', () => {
8182
const { wrapper } = getShallowMountedWrapper({ linkShare, sharedAncestor })
8283
const viaButton = wrapper.findComponent<typeof OcButton>('.oc-files-file-link-via')
8384
expect(viaButton.exists()).toBeTruthy()
84-
expect(viaButton.props('to').query.fileId).toEqual('ancestorId')
85+
const routeLocation = viaButton.props('to') as RouteLocationNamedRaw
86+
expect(routeLocation.query.fileId).toEqual('ancestorId')
8587
})
8688

8789
describe('additional information icons', () => {

0 commit comments

Comments
 (0)