aboutsummaryrefslogtreecommitdiffstats
path: root/apps/comments/src/actions/inlineUnreadCommentsAction.spec.ts
diff options
context:
space:
mode:
Diffstat (limited to 'apps/comments/src/actions/inlineUnreadCommentsAction.spec.ts')
-rw-r--r--apps/comments/src/actions/inlineUnreadCommentsAction.spec.ts38
1 files changed, 11 insertions, 27 deletions
diff --git a/apps/comments/src/actions/inlineUnreadCommentsAction.spec.ts b/apps/comments/src/actions/inlineUnreadCommentsAction.spec.ts
index aabbf42fadb..e8020f1f029 100644
--- a/apps/comments/src/actions/inlineUnreadCommentsAction.spec.ts
+++ b/apps/comments/src/actions/inlineUnreadCommentsAction.spec.ts
@@ -1,27 +1,11 @@
/**
- * @copyright Copyright (c) 2023 Lucas Azevedo <lhs_azevedo@hotmail.com>
- *
- * @author Lucas Azevedo <lhs_azevedo@hotmail.com>
- *
- * @license AGPL-3.0-or-later
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * 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 = {
@@ -46,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()
@@ -132,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: {
@@ -162,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: {
@@ -172,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,