fix(tests): 修复 CI 失败的测试 - 补充 withTranslation 和 CopyButton mock

- vitest.setup.ts: react-i18next mock 添加 withTranslation HOC(读取 zh/common.json 翻译)
- vitest.setup.ts: 添加 @/components/CopyButton 全局 mock
- App 测试: 补充 withTranslation 导出
- TextMode 测试: 修复多个 CopyButton 实例导致的 getByTestId 冲突,改用 getByRole
This commit is contained in:
雨霖铃
2026-05-27 23:42:44 +08:00
committed by Ubuntu
3 changed files with 70 additions and 6 deletions
@@ -21,6 +21,7 @@ vi.mock('react-i18next', () => ({
useTranslation: () => ({
t: (key: string) => key,
}),
withTranslation: () => (Component: any) => Component,
}));
describe('Options App', () => {