Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: Migrate build system to vite and vitest
Signed-off-by: Ferdinand Thiessen <[email protected]>
  • Loading branch information
susnux committed Jul 26, 2023
commit 883819cc790a757658e0c5b8d1201e6feeebbfbf
9 changes: 1 addition & 8 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
{
"extends": [
"@nextcloud/eslint-config/typescript"
],
"parserOptions": {
"babelOptions": {
"plugins": [
"@babel/plugin-syntax-import-assertions"
]
}
}
]
}
9 changes: 5 additions & 4 deletions __tests__/fileAction.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable no-new */
/* eslint-disable @typescript-eslint/no-explicit-any */
import { beforeEach, describe, expect, test, vi } from 'vitest'

import { getFileActions, registerFileAction, FileAction } from '../lib/fileAction'
import logger from '../lib/utils/logger'
Expand All @@ -11,15 +12,15 @@ describe('FileActions init', () => {
})

test('Getting empty uninitialized FileActions', () => {
logger.debug = jest.fn()
logger.debug = vi.fn()
const fileActions = getFileActions()
expect(window._nc_fileactions).toBeUndefined()
expect(fileActions).toHaveLength(0)
expect(logger.debug).toHaveBeenCalledTimes(0)
})

test('Initializing FileActions', () => {
logger.debug = jest.fn()
logger.debug = vi.fn()
const action = new FileAction({
id: 'test',
displayName: () => 'Test',
Expand All @@ -40,7 +41,7 @@ describe('FileActions init', () => {
})

test('Duplicate FileAction gets rejected', () => {
logger.error = jest.fn()
logger.error = vi.fn()
const action = new FileAction({
id: 'test',
displayName: () => 'Test',
Expand Down Expand Up @@ -176,7 +177,7 @@ describe('Invalid FileAction creation', () => {

describe('FileActions creation', () => {
test('create valid FileAction', async () => {
logger.debug = jest.fn()
logger.debug = vi.fn()
const action = new FileAction({
id: 'test',
displayName: () => 'Test',
Expand Down
2 changes: 2 additions & 0 deletions __tests__/files/file.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from 'vitest'

import { File } from '../../lib/files/file'
import { FileType } from '../../lib/files/fileType'
import { Permission } from '../../lib/permissions'
Expand Down
2 changes: 2 additions & 0 deletions __tests__/files/folder.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from 'vitest'

import { Folder } from '../../lib/files/folder'
import { FileType } from '../../lib/files/fileType'
import { Permission } from '../../lib/permissions'
Expand Down
2 changes: 2 additions & 0 deletions __tests__/files/node.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from 'vitest'

import { File } from '../../lib/files/file'
import { Folder } from '../../lib/files/folder'
import NodeData, { Attribute } from '../../lib/files/nodeData'
Expand Down
2 changes: 2 additions & 0 deletions __tests__/humanFileSize.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, it } from 'vitest'

import { formatFileSize } from '../lib/humanfilesize'

describe('humanFileSize', () => {
Expand Down
2 changes: 2 additions & 0 deletions __tests__/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, test } from 'vitest'

import {
formatFileSize,
addNewFileMenuEntry,
Expand Down
6 changes: 4 additions & 2 deletions __tests__/newFileMenu.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { describe, expect, test, vi } from 'vitest'

import { NewFileMenu, getNewFileMenu, type Entry } from '../lib/newFileMenu'
import logger from '../lib/utils/logger'

describe('NewFileMenu init', () => {
test('Initializing NewFileMenu', () => {
logger.debug = jest.fn()
logger.debug = vi.fn()
const newFileMenu = getNewFileMenu()
expect(window._nc_newfilemenu).toBeInstanceOf(NewFileMenu)
expect(window._nc_newfilemenu).toBe(newFileMenu)
Expand Down Expand Up @@ -224,7 +226,7 @@ describe('NewFileMenu removeEntry', () => {
})

test('Removing a non-existing entry', () => {
logger.warn = jest.fn()
logger.warn = vi.fn()
const newFileMenu = new NewFileMenu()

newFileMenu.unregisterEntry('unknown-entry')
Expand Down
2 changes: 2 additions & 0 deletions __tests__/permissions.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, it, expect } from 'vitest'

import { parseWebdavPermissions, Permission } from '../lib/permissions'

const dataSet = [
Expand Down
15 changes: 0 additions & 15 deletions jest.config.js

This file was deleted.

Loading