Files
novalon-website/test-framework/shared/utils/testing/TestDataFactory.ts
T
zhangxiang 602ed6a671 test(hooks): finalize mutation test improvements and release acceptance
- Raise use-swipe-gesture mutation score to 66.13% (target 65%+)
- Maintain use-reduced-motion mutation score at 76.32% (target 50%+)
- Fix use-reduced-motion.ts ESLint set-state-in-effect warning
- Add UJ-10 deep searcher journey (category browse → article read → content discovery)
- Add 40 new test files (analytics, detail, sections, ui, lib components)
- Update test-strategy-plan.md to v2.0 (sync test count to 1591)
- Sync README.md with final release metrics

Quality gates: TS 0 errors, ESLint 0 errors, 121 suites / 1591 tests passed
2026-08-02 19:39:27 +08:00

70 lines
1.8 KiB
TypeScript

// @ts-nocheck
import { performanceThresholds } from '../../config/test-data';
export interface ContactFormData {
name: string;
email: string;
phone: string;
message: string;
subject?: string;
}
export interface PerformanceData {
url: string;
thresholds: typeof performanceThresholds;
}
export interface SEOData {
url: string;
expectedTitle: string;
expectedDescription: string;
}
export class TestDataFactory {
private static cache: Map<string, any> = new Map();
static createContactForm(overrides?: Partial<ContactFormData>): ContactFormData {
const cacheKey = 'contact-form';
if (!this.cache.has(cacheKey)) {
this.cache.set(cacheKey, {
name: '测试用户',
email: 'test@example.com',
phone: '13800138000',
message: '这是一条测试消息,用于测试表单提交功能',
subject: '测试主题'
});
}
return { ...this.cache.get(cacheKey), ...overrides };
}
static createPerformanceData(overrides?: Partial<PerformanceData>): PerformanceData {
const cacheKey = 'performance-data';
if (!this.cache.has(cacheKey)) {
this.cache.set(cacheKey, {
url: 'http://localhost:3000',
thresholds: performanceThresholds
});
}
return { ...this.cache.get(cacheKey), ...overrides };
}
static createSEOData(overrides?: Partial<SEOData>): SEOData {
const cacheKey = 'seo-data';
if (!this.cache.has(cacheKey)) {
this.cache.set(cacheKey, {
url: 'http://localhost:3000',
expectedTitle: 'Novalon - 创新科技解决方案',
expectedDescription: 'Novalon提供专业的科技解决方案'
});
}
return { ...this.cache.get(cacheKey), ...overrides };
}
static clearCache(): void {
this.cache.clear();
}
}