diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-08-24 16:53:33 +0200 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-08-26 17:27:22 +0200 |
commit | a5e58dc45e2078fa6e2330e78d17a73f92168974 (patch) | |
tree | 508f45285616e97677b5493f10a4e0513d478924 /apps/files_external | |
parent | c0b39bb9095b9e0421314c99d3ff0e149a21c435 (diff) | |
download | nextcloud-server-a5e58dc45e2078fa6e2330e78d17a73f92168974.tar.gz nextcloud-server-a5e58dc45e2078fa6e2330e78d17a73f92168974.zip |
test: Migrated all Jest tests to vitest
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'apps/files_external')
3 files changed, 11 insertions, 9 deletions
diff --git a/apps/files_external/src/actions/enterCredentialsAction.spec.ts b/apps/files_external/src/actions/enterCredentialsAction.spec.ts index 518b48c264d..5d1ff05e229 100644 --- a/apps/files_external/src/actions/enterCredentialsAction.spec.ts +++ b/apps/files_external/src/actions/enterCredentialsAction.spec.ts @@ -2,10 +2,11 @@ * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ -import { action } from './enterCredentialsAction' -import { expect } from '@jest/globals' -import { File, Folder, Permission, View, DefaultType, FileAction } from '@nextcloud/files' import type { StorageConfig } from '../services/externalStorage' + +import { File, Folder, Permission, View, DefaultType, FileAction } from '@nextcloud/files' +import { describe, expect, test } from 'vitest' +import { action } from './enterCredentialsAction' import { STORAGE_STATUS } from '../utils/credentialsUtils' const view = { @@ -36,7 +37,7 @@ describe('Enter credentials action conditions tests', () => { expect(action).toBeInstanceOf(FileAction) expect(action.id).toBe('credentials-external-storage') expect(action.displayName([storage], externalStorageView)).toBe('Enter missing credentials') - expect(action.iconSvgInline([storage], externalStorageView)).toBe('<svg>SvgMock</svg>') + expect(action.iconSvgInline([storage], externalStorageView)).toMatch(/<svg.+<\/svg>/) expect(action.default).toBe(DefaultType.DEFAULT) expect(action.order).toBe(-1000) expect(action.inline!(storage, externalStorageView)).toBe(true) diff --git a/apps/files_external/src/actions/openInFilesAction.spec.ts b/apps/files_external/src/actions/openInFilesAction.spec.ts index 83aa38f1753..aa9573eca77 100644 --- a/apps/files_external/src/actions/openInFilesAction.spec.ts +++ b/apps/files_external/src/actions/openInFilesAction.spec.ts @@ -2,10 +2,11 @@ * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ -import { action } from './openInFilesAction' -import { expect } from '@jest/globals' import { Folder, Permission, View, DefaultType, FileAction } from '@nextcloud/files' +import { describe, expect, test, vi } from 'vitest' + import type { StorageConfig } from '../services/externalStorage' +import { action } from './openInFilesAction' import { STORAGE_STATUS } from '../utils/credentialsUtils' const view = { @@ -73,7 +74,7 @@ describe('Open in files action enabled tests', () => { describe('Open in files action execute tests', () => { test('Open in files', 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 } } } @@ -98,7 +99,7 @@ describe('Open in files action execute tests', () => { }) test('Open in files broken storage', async () => { - const confirmMock = jest.fn() + const confirmMock = vi.fn() // @ts-expect-error We only mock what is needed window.OC = { dialogs: { confirm: confirmMock } } diff --git a/apps/files_external/src/utils/externalStorageUtils.spec.ts b/apps/files_external/src/utils/externalStorageUtils.spec.ts index 55d3773a917..a6a29e27a7c 100644 --- a/apps/files_external/src/utils/externalStorageUtils.spec.ts +++ b/apps/files_external/src/utils/externalStorageUtils.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, Permission } from '@nextcloud/files' +import { describe, expect, test } from 'vitest' import { isNodeExternalStorage } from './externalStorageUtils' describe('Is node an external storage', () => { |