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/comments/src | |
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/comments/src')
-rw-r--r-- | apps/comments/src/actions/inlineUnreadCommentsAction.spec.ts | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/apps/comments/src/actions/inlineUnreadCommentsAction.spec.ts b/apps/comments/src/actions/inlineUnreadCommentsAction.spec.ts index dc8892769e3..e8020f1f029 100644 --- a/apps/comments/src/actions/inlineUnreadCommentsAction.spec.ts +++ b/apps/comments/src/actions/inlineUnreadCommentsAction.spec.ts @@ -2,9 +2,10 @@ * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ -import { action } from './inlineUnreadCommentsAction' -import { expect } from '@jest/globals' import { File, Permission, View, FileAction } from '@nextcloud/files' +import { describe, expect, test, vi } from 'vitest' + +import { action } from './inlineUnreadCommentsAction' import logger from '../logger' const view = { @@ -29,7 +30,7 @@ describe('Inline unread comments action display name tests', () => { expect(action.id).toBe('comments-unread') expect(action.displayName([file], view)).toBe('') expect(action.title!([file], view)).toBe('1 new comment') - expect(action.iconSvgInline([], view)).toBe('<svg>SvgMock</svg>') + expect(action.iconSvgInline([], view)).toMatch(/<svg.+<\/svg>/) expect(action.enabled!([file], view)).toBe(true) expect(action.inline!(file, view)).toBe(true) expect(action.default).toBeUndefined() @@ -115,8 +116,8 @@ describe('Inline unread comments action enabled tests', () => { describe('Inline unread comments action execute tests', () => { test('Action opens sidebar', async () => { - const openMock = jest.fn() - const setActiveTabMock = jest.fn() + const openMock = vi.fn() + const setActiveTabMock = vi.fn() window.OCA = { Files: { Sidebar: { @@ -145,8 +146,8 @@ describe('Inline unread comments action execute tests', () => { }) test('Action handles sidebar open failure', async () => { - const openMock = jest.fn(() => { throw new Error('Mock error') }) - const setActiveTabMock = jest.fn() + const openMock = vi.fn(() => { throw new Error('Mock error') }) + const setActiveTabMock = vi.fn() window.OCA = { Files: { Sidebar: { @@ -155,7 +156,7 @@ describe('Inline unread comments action execute tests', () => { }, }, } - jest.spyOn(logger, 'error').mockImplementation(() => jest.fn()) + vi.spyOn(logger, 'error').mockImplementation(() => vi.fn()) const file = new File({ id: 1, |