Skip to content

Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.

test: enable vitest typecheck and fix mock types

johavene0c14f2245ce
diff --git a/backend/src/applications/files/services/files-content-indexer.service.spec.ts b/backend/src/applications/files/services/files-content-indexer.service.spec.ts
index 2f9578c6..5350e887 100644
--- a/backend/src/applications/files/services/files-content-indexer.service.spec.ts
+++ b/backend/src/applications/files/services/files-content-indexer.service.spec.ts
@@ -18,6 +18,7 @@ import * as docTextifyModule from '../utils/doc-textify/doc-textify'
import { OCRManager } from '../utils/doc-textify/utils/ocr'
import { FilesContentParser } from './files-content-parser.service'
import { FilesContentIndexer } from './files-content-indexer.service'
+import type { Mock } from 'vitest'
interface CacheMock {
has: Mock
diff --git a/backend/src/applications/files/services/files-event-manager.service.spec.ts b/backend/src/applications/files/services/files-event-manager.service.spec.ts
index deee89fc..ef11911d 100644
--- a/backend/src/applications/files/services/files-event-manager.service.spec.ts
+++ b/backend/src/applications/files/services/files-event-manager.service.spec.ts
@@ -9,11 +9,11 @@ import { CACHE_INDEXING_EVENT_TTL } from '../constants/indexing'
import { quotaCacheKeyFromSpace } from '../utils/quota'
import { indexingUpdateCacheKeysFromSpace } from '../utils/indexing'
import { configuration } from '../../../configuration/config.environment'
-import { Mock } from 'vitest'
+import type { Mock } from 'vitest'
describe(FilesEventManager.name, () => {
let service: FilesEventManager
- let cacheSetMock: Mock<Promise<boolean>, [string, unknown, number?]>
+ let cacheSetMock: Mock<(key: string, value: unknown, ttl?: number) => Promise<boolean>>
let contentIndexingEnabled: boolean
const buildEvent = (props?: Partial<FileEventType>): FileEventType =>
diff --git a/backend/src/applications/files/utils/download-file.spec.ts b/backend/src/applications/files/utils/download-file.spec.ts
index 1e3303a4..5da5d430 100644
--- a/backend/src/applications/files/utils/download-file.spec.ts
+++ b/backend/src/applications/files/utils/download-file.spec.ts
@@ -7,6 +7,7 @@ import { FileError } from '../models/file-error'
import { FILE_ERROR_MESSAGES } from './errors'
import { writeFromStream } from './files'
import { DownloadFile } from './download-file'
+import type { Mock } from 'vitest'
vi.mock('./files', () => ({
writeFromStream: vi.fn()
diff --git a/backend/vitest.config.mts b/backend/vitest.config.mts
index 827b2a0c..69fb7755 100644
--- a/backend/vitest.config.mts
+++ b/backend/vitest.config.mts
@@ -7,21 +7,18 @@ export default defineConfig({
globals: true,
root: './',
testTimeout: 30000,
+ typecheck: {
+ enabled: true
+ },
coverage: {
provider: 'v8',
reportsDirectory: '../coverage/units',
- exclude: [
- '**/*-controller.service.{ts,js}',
- '**/*-queries.service.{ts,js}',
- '**/*-scheduler.service.{ts,js}',
- 'dist/**',
- 'node_modules/**'
- ]
+ exclude: ['**/*-controller.service.{ts,js}', '**/*-queries.service.{ts,js}', '**/*-scheduler.service.{ts,js}', 'dist/**', 'node_modules/**']
}
},
plugins: [
swc.vite({
- module: {type: 'es6'}
+ module: { type: 'es6' }
})
]
})