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 = new Map(); static createContactForm(overrides?: Partial): 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 { 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 { 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(); } }