Commit Graph

5 Commits

  • fix: resolve TypeScript type errors in test files
    - Add vitest/globals to tsconfig.json types array to provide type
      definitions for global test functions (describe, it, expect, vi)
    - Fix vi.fn type parameter in useDirectorySettings.test.tsx from
      <[], Promise<string>> to <() => Promise<string>>
    - Remove unused setMcpConfig import from MSW handlers
    - Add type assertions for mock.calls access in McpFormModal tests
      to resolve union type inference issues
    
    This ensures pnpm typecheck passes without errors while maintaining
    test functionality with vitest globals: true configuration.
  • test: add frontend testing infrastructure with vitest
    - Introduce Vitest + React Testing Library + jsdom environment
    - Add useDragSort hook unit tests covering:
      * Sorting logic (sortIndex → createdAt → name)
      * Successful drag operation (API call + cache invalidation)
      * Failed drag operation (error toast display)
      * Edge case (no valid target, no API call)
    - Configure global test setup (i18n mock, auto cleanup)
    - Update TypeScript configs to include tests/ directory
    - Add test development plan documentation
    
    Test Coverage:
      ✓ Provider drag-and-drop sorting core logic
      ✓ React Query cache refresh
      ✓ Toast notification display
      ✓ Boundary condition handling
    
    Test Results: 4/4 passed (671ms)
    Next Steps: Sprint 2 - component tests with MSW mock layer
  • - fix(types): 统一导入到 src/types.ts,移除 shared/types 残留路径
    - chore(tsconfig): 将 include 扩展为 src/**/* 覆盖迁移后的源文件
    - feat(build): Vite 设置 root 为 src,并将 build.outDir 设为 ../dist 以匹配 Tauri frontendDist
    - refactor(api): 去除未使用的 plugin-shell import;统一 electronAPI 类型定义至 vite-env.d.ts
    - build: 验证 renderer 构建通过,产物输出至 dist/