diff options
Diffstat (limited to 'apps/files/src/actions/openFolderAction.spec.ts')
-rw-r--r-- | apps/files/src/actions/openFolderAction.spec.ts | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/apps/files/src/actions/openFolderAction.spec.ts b/apps/files/src/actions/openFolderAction.spec.ts index 57827ddc208..066ad5d86d8 100644 --- a/apps/files/src/actions/openFolderAction.spec.ts +++ b/apps/files/src/actions/openFolderAction.spec.ts @@ -2,8 +2,8 @@ * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ -import { expect } from '@jest/globals' import { File, Folder, Node, Permission, View, DefaultType, FileAction } from '@nextcloud/files' +import { describe, expect, test, vi } from 'vitest' import { action } from './openFolderAction' @@ -24,7 +24,7 @@ describe('Open folder action conditions tests', () => { expect(action).toBeInstanceOf(FileAction) expect(action.id).toBe('open-folder') expect(action.displayName([folder], view)).toBe('Open folder FooBar') - expect(action.iconSvgInline([], view)).toBe('<svg>SvgMock</svg>') + expect(action.iconSvgInline([], view)).toMatch(/<svg.+<\/svg>/) expect(action.default).toBe(DefaultType.HIDDEN) expect(action.order).toBe(-100) }) @@ -100,7 +100,8 @@ describe('Open folder action enabled tests', () => { describe('Open folder action execute tests', () => { test('Open folder', async () => { - const goToRouteMock = jest.fn() + const goToRouteMock = vi.fn() + // @ts-expect-error We only mock what needed, we do not need Files.Router.goTo or Files.Navigation window.OCP = { Files: { Router: { goToRoute: goToRouteMock } } } const folder = new Folder({ @@ -114,11 +115,12 @@ describe('Open folder action execute tests', () => { // Silent action expect(exec).toBe(null) expect(goToRouteMock).toBeCalledTimes(1) - expect(goToRouteMock).toBeCalledWith(null, { fileid: 1, view: 'files' }, { dir: '/FooBar' }) + expect(goToRouteMock).toBeCalledWith(null, { fileid: '1', view: 'files' }, { dir: '/FooBar' }) }) test('Open folder fails without node', async () => { - const goToRouteMock = jest.fn() + const goToRouteMock = vi.fn() + // @ts-expect-error We only mock what needed, we do not need Files.Router.goTo or Files.Navigation window.OCP = { Files: { Router: { goToRoute: goToRouteMock } } } const exec = await action.exec(null as unknown as Node, view, '/') @@ -127,7 +129,8 @@ describe('Open folder action execute tests', () => { }) test('Open folder fails without Folder', async () => { - const goToRouteMock = jest.fn() + const goToRouteMock = vi.fn() + // @ts-expect-error We only mock what needed, we do not need Files.Router.goTo or Files.Navigation window.OCP = { Files: { Router: { goToRoute: goToRouteMock } } } const file = new File({ |