40384ec024
- 增强服务数据模型,添加 challenges 和 outcomes 字段 - 简化统计数据配置,改为静态定义 - 重构多个页面组件,优化代码结构 - 新增产品、服务、解决方案相关的布局和组件 - 更新样式和动画配置 - 优化测试用例和类型定义 - 修复 ESLint 错误:移除不必要的 useEffect 和未使用的导入
242 lines
7.2 KiB
TypeScript
242 lines
7.2 KiB
TypeScript
import { describe, it, expect } from '@jest/globals';
|
|
import {
|
|
COMPANY_INFO,
|
|
NAVIGATION,
|
|
STATS,
|
|
SERVICES,
|
|
PRODUCTS,
|
|
NEWS,
|
|
} from './constants';
|
|
|
|
describe('Constants', () => {
|
|
describe('COMPANY_INFO', () => {
|
|
it('should have company name', () => {
|
|
expect(COMPANY_INFO.name).toBe('四川睿新致远科技有限公司');
|
|
});
|
|
|
|
it('should have short name', () => {
|
|
expect(COMPANY_INFO.shortName).toBe('睿新致远');
|
|
});
|
|
|
|
it('should have slogan', () => {
|
|
expect(COMPANY_INFO.slogan).toBe('智连未来,成长伙伴');
|
|
});
|
|
|
|
it('should have contact information', () => {
|
|
expect(COMPANY_INFO.email).toBeDefined();
|
|
expect(COMPANY_INFO.address).toBeDefined();
|
|
});
|
|
|
|
it('should have legal information', () => {
|
|
expect(COMPANY_INFO.icp).toBeDefined();
|
|
expect(COMPANY_INFO.police).toBeDefined();
|
|
});
|
|
});
|
|
|
|
describe('NAVIGATION', () => {
|
|
it('should be an array', () => {
|
|
expect(Array.isArray(NAVIGATION)).toBe(true);
|
|
});
|
|
|
|
it('should have navigation items', () => {
|
|
expect(NAVIGATION.length).toBeGreaterThan(0);
|
|
});
|
|
|
|
it('should have required properties', () => {
|
|
NAVIGATION.forEach(item => {
|
|
expect(item).toHaveProperty('id');
|
|
expect(item).toHaveProperty('label');
|
|
expect(item).toHaveProperty('href');
|
|
});
|
|
});
|
|
|
|
it('should have home navigation', () => {
|
|
const homeNav = NAVIGATION.find(item => item.id === 'home');
|
|
expect(homeNav).toBeDefined();
|
|
expect(homeNav?.label).toBe('首页');
|
|
});
|
|
|
|
it('should have contact navigation', () => {
|
|
const contactNav = NAVIGATION.find(item => item.id === 'contact');
|
|
expect(contactNav).toBeDefined();
|
|
expect(contactNav?.href).toBe('/contact');
|
|
});
|
|
});
|
|
|
|
describe('STATS', () => {
|
|
it('should be an array', () => {
|
|
expect(Array.isArray(STATS)).toBe(true);
|
|
});
|
|
|
|
it('should have stat items', () => {
|
|
expect(STATS.length).toBeGreaterThan(0);
|
|
});
|
|
|
|
it('should have required properties', () => {
|
|
STATS.forEach(stat => {
|
|
expect(stat).toHaveProperty('value');
|
|
expect(stat).toHaveProperty('label');
|
|
});
|
|
});
|
|
|
|
it('should have numeric values', () => {
|
|
STATS.forEach(stat => {
|
|
expect(stat.value).toMatch(/\d+/);
|
|
});
|
|
});
|
|
});
|
|
|
|
describe('SERVICES', () => {
|
|
it('should be an array', () => {
|
|
expect(Array.isArray(SERVICES)).toBe(true);
|
|
});
|
|
|
|
it('should have service items', () => {
|
|
expect(SERVICES.length).toBeGreaterThan(0);
|
|
});
|
|
|
|
it('should have required properties', () => {
|
|
SERVICES.forEach(service => {
|
|
expect(service).toHaveProperty('id');
|
|
expect(service).toHaveProperty('title');
|
|
expect(service).toHaveProperty('description');
|
|
expect(service).toHaveProperty('icon');
|
|
expect(service).toHaveProperty('features');
|
|
expect(service).toHaveProperty('benefits');
|
|
expect(service).toHaveProperty('process');
|
|
});
|
|
});
|
|
|
|
it('should have software service', () => {
|
|
const softwareService = SERVICES.find(s => s.id === 'software');
|
|
expect(softwareService).toBeDefined();
|
|
expect(softwareService?.title).toBe('软件开发');
|
|
});
|
|
|
|
it('should have consulting service', () => {
|
|
const consultingService = SERVICES.find(s => s.id === 'consulting');
|
|
expect(consultingService).toBeDefined();
|
|
expect(consultingService?.title).toBe('技术咨询');
|
|
});
|
|
|
|
it('should have data service', () => {
|
|
const dataService = SERVICES.find(s => s.id === 'data');
|
|
expect(dataService).toBeDefined();
|
|
expect(dataService?.title).toBe('数据分析');
|
|
});
|
|
|
|
it('should have solutions service', () => {
|
|
const solutionsService = SERVICES.find(s => s.id === 'solutions');
|
|
expect(solutionsService).toBeDefined();
|
|
expect(solutionsService?.title).toBe('解决方案');
|
|
});
|
|
|
|
it('should have features as array', () => {
|
|
SERVICES.forEach(service => {
|
|
expect(Array.isArray(service.features)).toBe(true);
|
|
expect(service.features.length).toBeGreaterThan(0);
|
|
});
|
|
});
|
|
|
|
it('should have benefits as array', () => {
|
|
SERVICES.forEach(service => {
|
|
expect(Array.isArray(service.benefits)).toBe(true);
|
|
expect(service.benefits.length).toBeGreaterThan(0);
|
|
});
|
|
});
|
|
});
|
|
|
|
describe('PRODUCTS', () => {
|
|
it('should be an array', () => {
|
|
expect(Array.isArray(PRODUCTS)).toBe(true);
|
|
});
|
|
|
|
it('should have product items', () => {
|
|
expect(PRODUCTS.length).toBeGreaterThan(0);
|
|
});
|
|
|
|
it('should have required properties', () => {
|
|
PRODUCTS.forEach(product => {
|
|
expect(product).toHaveProperty('id');
|
|
expect(product).toHaveProperty('title');
|
|
expect(product).toHaveProperty('description');
|
|
expect(product).toHaveProperty('category');
|
|
expect(product).toHaveProperty('features');
|
|
expect(product).toHaveProperty('benefits');
|
|
expect(product).toHaveProperty('pricing');
|
|
});
|
|
});
|
|
|
|
it('should have ERP product', () => {
|
|
const erpProduct = PRODUCTS.find(p => p.id === 'erp');
|
|
expect(erpProduct).toBeDefined();
|
|
expect(erpProduct?.title).toContain('ERP');
|
|
});
|
|
|
|
it('should have CRM product', () => {
|
|
const crmProduct = PRODUCTS.find(p => p.id === 'crm');
|
|
expect(crmProduct).toBeDefined();
|
|
expect(crmProduct?.title).toContain('客户关系管理');
|
|
});
|
|
|
|
it('should have CMS product', () => {
|
|
const cmsProduct = PRODUCTS.find(p => p.id === 'cms');
|
|
expect(cmsProduct).toBeDefined();
|
|
expect(cmsProduct?.title).toContain('内容管理');
|
|
});
|
|
|
|
it('should have BI product', () => {
|
|
const biProduct = PRODUCTS.find(p => p.id === 'bi');
|
|
expect(biProduct).toBeDefined();
|
|
expect(biProduct?.title).toContain('商业智能');
|
|
});
|
|
|
|
it('should have pricing object', () => {
|
|
PRODUCTS.forEach(product => {
|
|
expect(product.pricing).toHaveProperty('base');
|
|
expect(product.pricing).toHaveProperty('standard');
|
|
expect(product.pricing).toHaveProperty('enterprise');
|
|
});
|
|
});
|
|
});
|
|
|
|
describe('NEWS', () => {
|
|
it('should be an array', () => {
|
|
expect(Array.isArray(NEWS)).toBe(true);
|
|
});
|
|
|
|
it('should have news items', () => {
|
|
expect(NEWS.length).toBeGreaterThan(0);
|
|
});
|
|
|
|
it('should have required properties', () => {
|
|
NEWS.forEach(news => {
|
|
expect(news).toHaveProperty('id');
|
|
expect(news).toHaveProperty('title');
|
|
expect(news).toHaveProperty('excerpt');
|
|
expect(news).toHaveProperty('date');
|
|
expect(news).toHaveProperty('category');
|
|
expect(news).toHaveProperty('content');
|
|
});
|
|
});
|
|
|
|
it('should have valid categories', () => {
|
|
const validCategories = ['公司新闻', '产品发布', '合作动态', '行业资讯'];
|
|
NEWS.forEach(news => {
|
|
expect(validCategories).toContain(news.category);
|
|
});
|
|
});
|
|
|
|
it('should have valid date format', () => {
|
|
NEWS.forEach(news => {
|
|
expect(news.date).toMatch(/^\d{4}-\d{2}-\d{2}$/);
|
|
});
|
|
});
|
|
|
|
it('should have founding news', () => {
|
|
const foundingNews = NEWS.find(n => n.title.includes('成立'));
|
|
expect(foundingNews).toBeDefined();
|
|
});
|
|
});
|
|
});
|