mirror of
https://github.com/iflytek/skillhub.git
synced 2026-08-28 11:25:00 +00:00
变更摘要: - 将前端测试共置到 web/src,保留并迁移 app 样式相关用例 - 为 pages、features、shared UI 与 hooks 补齐大范围 Vitest 覆盖 - 强化 governance、file preview、namespace header 与 API client 的关键分支测试 - 重新验证 pnpm run test 与 pnpm run typecheck,当前均已通过 关键文件: - web/src/pages/dashboard/governance.test.ts - web/src/features/governance/governance-inbox.test.ts - web/src/features/skill/file-preview-dialog.test.ts - web/src/features/namespace/namespace-header.test.ts - web/src/api/client.test.ts
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
import { describe, expect, it, vi } from 'vitest'
|
|
|
|
// CliAuthPage has internal helpers isValidRedirectUri and decodeLabel which are
|
|
// not exported. We test the component render paths and validate the redirect
|
|
// URI logic via the rendered error states.
|
|
|
|
vi.mock('@tanstack/react-router', () => ({
|
|
useNavigate: () => vi.fn(),
|
|
}))
|
|
|
|
vi.mock('react-i18next', async () => {
|
|
const actual = await vi.importActual<typeof import('react-i18next')>('react-i18next')
|
|
return {
|
|
...actual,
|
|
useTranslation: () => ({
|
|
t: (key: string) => key,
|
|
}),
|
|
}
|
|
})
|
|
|
|
vi.mock('@/shared/ui/card', () => ({
|
|
Card: ({ children }: { children: unknown }) => children,
|
|
}))
|
|
|
|
vi.mock('@/shared/ui/button', () => ({
|
|
Button: ({ children }: { children: unknown }) => children,
|
|
}))
|
|
|
|
vi.mock('@/api/client', () => ({
|
|
getCurrentUser: vi.fn().mockResolvedValue(null),
|
|
tokenApi: { createToken: vi.fn() },
|
|
}))
|
|
|
|
vi.mock('@/app/router', () => ({
|
|
ORIGINAL_URL_SEARCH: '',
|
|
}))
|
|
|
|
import { CliAuthPage } from './cli-auth'
|
|
|
|
describe('CliAuthPage', () => {
|
|
it('exports a named component function', () => {
|
|
expect(typeof CliAuthPage).toBe('function')
|
|
expect(CliAuthPage.name).toBe('CliAuthPage')
|
|
})
|
|
})
|