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:
@@ -11,7 +11,9 @@ jest.mock('framer-motion', () => ({
|
||||
}));
|
||||
|
||||
jest.mock('next/link', () => {
|
||||
return ({ children, href }: any) => <a href={href}>{children}</a>;
|
||||
const MockLink = ({ children, href }: any) => <a href={href}>{children}</a>;
|
||||
MockLink.displayName = 'MockLink';
|
||||
return MockLink;
|
||||
});
|
||||
|
||||
describe('AboutSection', () => {
|
||||
@@ -33,12 +35,12 @@ describe('AboutSection', () => {
|
||||
|
||||
it('should render company slogan', () => {
|
||||
render(<AboutSection />);
|
||||
expect(screen.getByText(/企业需要的/)).toBeInTheDocument();
|
||||
expect(screen.getByText(/数字化转型不是一场冒险/)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should render company mission', () => {
|
||||
render(<AboutSection />);
|
||||
expect(screen.getByText(/我们只做一件事/)).toBeInTheDocument();
|
||||
expect(screen.getByText(/务实/)).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -51,21 +53,17 @@ describe('AboutSection', () => {
|
||||
|
||||
it('should display statistics in grid layout', () => {
|
||||
const { container } = render(<AboutSection />);
|
||||
const grid = container.querySelector('.grid-cols-2');
|
||||
const grid = container.querySelector('.grid-cols-1');
|
||||
expect(grid).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Call to Action', () => {
|
||||
it('should render learn more button', () => {
|
||||
it('should render value cards with titles', () => {
|
||||
render(<AboutSection />);
|
||||
expect(screen.getByRole('link', { name: /了解更多关于我们/ })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should link to about page', () => {
|
||||
render(<AboutSection />);
|
||||
const link = screen.getByRole('link', { name: /了解更多关于我们/ });
|
||||
expect(link).toHaveAttribute('href', '/about');
|
||||
expect(screen.getByText('务实')).toBeInTheDocument();
|
||||
expect(screen.getByText('共情')).toBeInTheDocument();
|
||||
expect(screen.getByText('敏捷')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -99,7 +97,7 @@ describe('AboutSection', () => {
|
||||
it('should have proper padding', () => {
|
||||
render(<AboutSection />);
|
||||
const section = document.querySelector('section#about');
|
||||
expect(section).toHaveClass('py-24');
|
||||
expect(section).toHaveClass('py-20');
|
||||
});
|
||||
|
||||
it('should have decorative background pattern', () => {
|
||||
|
||||
Reference in New Issue
Block a user