Skip to content

Commit

Permalink
chore: Migrate build system to vite and vitest
Browse files Browse the repository at this point in the history
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
  • Loading branch information
susnux committed Jul 25, 2023
1 parent 3999b9b commit ec3a11d
Show file tree
Hide file tree
Showing 15 changed files with 3,991 additions and 4,059 deletions.
9 changes: 1 addition & 8 deletions .eslintrc.json
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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.

0 comments on commit ec3a11d

Please sign in to comment.