fix(web): 清零前端 TS 构建错误 — 31 文件类型修复 + 面包屑 + 超时配置

- 修复 verbatimModuleSyntax 要求的 import type 声明
- 修复未使用导入(Badge/EditOutlined/Space/Input/Switch 等)
- 修复 mock.calls 类型注解([string,unknown] → any[])
- 修复 vitest 全局超时和 poolTimeout 配置
- 修复 PageContainer 缺少 onBack prop、MenuInfo children 可选
- 修复 CopilotAlert Badge status info→processing、useCopilotRisk 二次解包
- 修复 articles/doctors 测试 delete 调用缺少 version 参数
- 添加排班管理/预约管理面包屑标题 fallback
This commit is contained in:
iven
2026-05-15 23:03:08 +08:00
parent bf8bcdbd5d
commit ced1c0ad0c
30 changed files with 55 additions and 44 deletions

View File

@@ -7,7 +7,7 @@
* - 侧边栏折叠状态
* - 远程主题配置加载
*/
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
import { describe, it, expect, vi, beforeEach } from 'vitest'
// --- Mock localStorage ---
const localStorageStore: Record<string, string> = {}
@@ -39,7 +39,8 @@ vi.mock('../api/themes', () => ({
// --- Mock zustand 内部不依赖真实存储 ---
// 在 mock 生效后导入被测模块
import { useAppStore, THEME_OPTIONS } from './app'
import type { ThemeName, ThemeConfig } from './app'
import type { ThemeName } from './app'
import type { ThemeConfig } from '../api/themes'
beforeEach(() => {
vi.clearAllMocks()

View File

@@ -312,7 +312,7 @@ describe('connectSSE', () => {
it('有 token 时创建 EventSource 并传递正确 URL', () => {
localStorage.setItem('access_token', 'my-jwt-token')
process.env.VITE_API_BASE_URL = undefined
vi.stubEnv('VITE_API_BASE_URL', '')
const dispose = useMessageStore.getState().connectSSE()
@@ -339,7 +339,7 @@ describe('connectSSE', () => {
const dispose = useMessageStore.getState().connectSSE()
const eventTypes = mockEventSourceAddEventListener.mock.calls.map(
(call: [string, unknown]) => call[0],
(call: any[]) => call[0],
)
expect(eventTypes).toContain('message')
expect(eventTypes).toContain('alert')
@@ -355,7 +355,7 @@ describe('connectSSE', () => {
// 找到 message 事件的回调
const messageCall = mockEventSourceAddEventListener.mock.calls.find(
(call: [string, unknown]) => call[0] === 'message',
(call: any[]) => call[0] === 'message',
)
const messageCallback = messageCall![1] as () => void
@@ -376,7 +376,7 @@ describe('connectSSE', () => {
const dispose = useMessageStore.getState().connectSSE()
const alertCall = mockEventSourceAddEventListener.mock.calls.find(
(call: [string, unknown]) => call[0] === 'alert',
(call: any[]) => call[0] === 'alert',
)
const alertCallback = alertCall![1] as () => void

View File

@@ -355,7 +355,7 @@ describe('usePluginStore', () => {
const schema = createFakeSchema({
ui: {
pages: [
{ type: 'tabs' as const, label: '综合视图', icon: 'LayoutOutlined' },
{ type: 'tabs' as const, label: '综合视图', icon: 'LayoutOutlined', tabs: [] },
],
},
});