feat(front): add Vitest configuration and unit tests for calcFileHash to ensure consistency between native and wasm engines

This commit is contained in:
keven1024
2026-04-09 10:34:37 +08:00
parent 958ca799da
commit 18ca80bb1b
2 changed files with 16 additions and 1 deletions

View File

@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest' import { describe, it, expect } from 'vitest'
import calcFileHash from './calcFileHash' import calcFileHash from '@/lib/calcFileHash'
const makeFile = (content: string) => new File([content], 'test.txt', { type: 'text/plain' }) const makeFile = (content: string) => new File([content], 'test.txt', { type: 'text/plain' })

15
front/vitest.config.ts Normal file
View File

@@ -0,0 +1,15 @@
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vitest/config'
const rootDir = fileURLToPath(new URL('./', import.meta.url))
export default defineConfig({
resolve: {
alias: [
{ find: /^@\/(.*)$/, replacement: `${rootDir}$1` },
{ find: /^~\/(.*)$/, replacement: `${rootDir}$1` },
{ find: /^@@\/(.*)$/, replacement: `${rootDir}$1` },
{ find: /^~~\/(.*)$/, replacement: `${rootDir}$1` },
],
},
})