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
@@ -41,7 +41,7 @@ describe('MobileTabBar', () => {
expect(screen.getByText('首页')).toBeInTheDocument();
expect(screen.getByText('服务')).toBeInTheDocument();
expect(screen.getByText('产品')).toBeInTheDocument();
expect(screen.getByText('新闻')).toBeInTheDocument();
expect(screen.getByText('关于')).toBeInTheDocument();
expect(screen.getByText('联系')).toBeInTheDocument();
});
@@ -76,19 +76,19 @@ describe('MobileTabBar', () => {
it('should have correct href for services', () => {
render(<MobileTabBar />);
const servicesLink = screen.getByText('服务').closest('a');
expect(servicesLink).toHaveAttribute('href', '/#services');
expect(servicesLink).toHaveAttribute('href', '/services');
});
it('should have correct href for products', () => {
render(<MobileTabBar />);
const productsLink = screen.getByText('产品').closest('a');
expect(productsLink).toHaveAttribute('href', '/#products');
expect(productsLink).toHaveAttribute('href', '/products');
});
it('should have correct href for news', () => {
it('should have correct href for about', () => {
render(<MobileTabBar />);
const newsLink = screen.getByText('新闻').closest('a');
expect(newsLink).toHaveAttribute('href', '/#news');
const aboutLink = screen.getByText('关于').closest('a');
expect(aboutLink).toHaveAttribute('href', '/about');
});
it('should have correct href for contact', () => {