test: 修复因预发布模式文案变更导致的测试失败

- header/footer/mobile-menu/mobile-tab-bar: 更新导航项断言与 mock
- insight-card/page-header: 适配组件结构变更(InkGlowCard、Badge)
- about/products/news: 修复重复文本匹配,添加 PageNav/date-fns mock
- constants: 更新服务标题断言
- 修复 mock 组件缺少 displayName 的 ESLint 错误
This commit is contained in:
张翔
2026-05-03 13:36:40 +08:00
parent f69de14e45
commit d51a99e645
11 changed files with 237 additions and 123 deletions
@@ -10,9 +10,11 @@ jest.mock('next/navigation', () => ({
}));
jest.mock('next/link', () => {
return ({ children, href }: { children: React.ReactNode; href: string }) => {
const MockLink = ({ children, href }: { children: React.ReactNode; href: string }) => {
return <a href={href}>{children}</a>;
};
MockLink.displayName = 'MockLink';
return MockLink;
});
jest.mock('framer-motion', () => ({
@@ -39,8 +41,8 @@ describe('NewsDetailClient', () => {
describe('Rendering', () => {
it('should render news detail page', () => {
render(<NewsDetailClient news={mockNews as any} />);
const container = screen.getByText('测试新闻标题').closest('div');
expect(container).toBeInTheDocument();
const titles = screen.getAllByText('测试新闻标题');
expect(titles.length).toBeGreaterThan(0);
});
it('should render news title', () => {