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:
@@ -93,6 +93,22 @@ jest.mock('@/components/ui/flip-clock', () => {
|
||||
return { FlipClock };
|
||||
});
|
||||
|
||||
jest.mock('@/components/layout/page-nav', () => ({
|
||||
PageNav: ({ items }: { items: Array<{ label: string }> }) => (
|
||||
<nav data-testid="page-nav">
|
||||
{items.map((item, i) => <span key={i}>{item.label}</span>)}
|
||||
</nav>
|
||||
),
|
||||
}));
|
||||
|
||||
jest.mock('date-fns', () => ({
|
||||
differenceInYears: () => 0,
|
||||
differenceInMonths: () => 0,
|
||||
differenceInDays: () => 0,
|
||||
subYears: (d: Date) => d,
|
||||
subMonths: (d: Date) => d,
|
||||
}));
|
||||
|
||||
jest.mock('@/lib/constants', () => ({
|
||||
COMPANY_INFO: {
|
||||
name: '四川睿新致远科技有限公司',
|
||||
@@ -100,14 +116,14 @@ jest.mock('@/lib/constants', () => ({
|
||||
displayName: '睿新致远',
|
||||
description: '以智慧连接数字趋势,以伙伴身份陪您成长',
|
||||
address: '四川省成都市龙泉驿区',
|
||||
email: 'contact@ruixin.com',
|
||||
phone: '028-12345678',
|
||||
email: 'contact@novalon.cn',
|
||||
phone: '028-88888888',
|
||||
},
|
||||
STATS: [
|
||||
{ value: '10+', label: '企业客户' },
|
||||
{ value: '20+', label: '成功案例' },
|
||||
{ value: '30+', label: '项目交付' },
|
||||
{ value: '12+', label: '年行业经验' },
|
||||
{ value: '6', label: '研发产品' },
|
||||
{ value: '5+', label: '行业覆盖' },
|
||||
{ value: '10+', label: '团队成员' },
|
||||
{ value: '12+', label: '年核心团队经验' },
|
||||
],
|
||||
}));
|
||||
|
||||
@@ -127,8 +143,8 @@ describe('AboutPage', () => {
|
||||
|
||||
it('should render company introduction', () => {
|
||||
render(<AboutPage />);
|
||||
const intro = screen.getByText(/关于我们/i);
|
||||
expect(intro).toBeInTheDocument();
|
||||
const intros = screen.getAllByText(/关于我们/i);
|
||||
expect(intros.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it('should render company history', () => {
|
||||
@@ -157,7 +173,7 @@ describe('AboutPage', () => {
|
||||
|
||||
it('should render statistics', () => {
|
||||
render(<AboutPage />);
|
||||
const stats = screen.getByText(/企业客户/i);
|
||||
const stats = screen.getByText(/研发产品/i);
|
||||
expect(stats).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user