mirror of
https://github.com/iflytek/skillhub.git
synced 2026-09-06 08:15:57 +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
33 lines
914 B
TypeScript
33 lines
914 B
TypeScript
import { renderToStaticMarkup } from 'react-dom/server'
|
|
import { describe, expect, it, vi } from 'vitest'
|
|
|
|
vi.mock('react-i18next', async () => {
|
|
const actual = await vi.importActual<typeof import('react-i18next')>('react-i18next')
|
|
return {
|
|
...actual,
|
|
useTranslation: () => ({
|
|
t: (key: string) => key,
|
|
i18n: { resolvedLanguage: 'en' },
|
|
}),
|
|
}
|
|
})
|
|
|
|
vi.mock('@/shared/components/legal-document', () => ({
|
|
LegalDocument: (props: { title: string; summary: string }) => (
|
|
<div>
|
|
<h1>{props.title}</h1>
|
|
<p>{props.summary}</p>
|
|
</div>
|
|
),
|
|
}))
|
|
|
|
import { TermsOfServicePage } from './terms'
|
|
|
|
describe('TermsOfServicePage', () => {
|
|
it('renders the english terms of service for non-chinese locales', () => {
|
|
const html = renderToStaticMarkup(<TermsOfServicePage />)
|
|
|
|
expect(html).toContain('Terms of Service')
|
|
expect(html).toContain('These terms apply')
|
|
})
|
|
})
|