tangweijie 4b78c43d42 test: 添加前端 API 单元测试
- 添加 vitest 测试框架配置
- 添加 src/api/__tests__/api.test.ts: 16个 API 测试
- 修复 points.ts 和 ledger.ts 导入问题

测试覆盖:
- AccountAPI: 物理账户和子账户方法
- TransactionAPI: transfer/deposit/withdraw
- LedgerAPI: subjects/entry/accountEntries
- ReconciliationAPI: 8个端点方法
- PointsAPI: 5个端点方法
- 类型定义和导出测试
2026-01-05 18:39:58 +08:00

25 lines
603 B
TypeScript

import { defineConfig } from 'vitest/config'
import vue from '@vitejs/plugin-vue'
import { fileURLToPath, URL } from 'node:url'
export default defineConfig({
plugins: [vue()],
test: {
globals: true,
environment: 'happy-dom',
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html'],
include: ['src/**/*.ts'],
exclude: ['src/**/*.d.ts', 'src/**/*.test.ts', 'src/mocks/**'],
},
},
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
}
})