FE_Dev / server /lib /theme /test-helpers.ts
GitHub Actions
Deploy from GitHub Actions [dev] - 2025-10-31 07:28:50
68f7925
import type { ThemeExtractionResult } from '@/schema/theme-extraction';
/**
* 有効なテーマデータを生成
*/
export function createValidTheme(): ThemeExtractionResult {
return {
colors: {
// メインカラー
primary_color: '#5a6c7d',
secondary_color: '#f8f9fa',
accent_color: '#f59e0b',
// セマンティックカラー
success_semantic_color: '#10b981',
warning_semantic_color: '#f59e0b',
error_semantic_color: '#ef4444',
info_semantic_color: '#3b82f6',
// 背景色
primary_background_color: '#ffffff',
secondary_background_color: '#f8f9fa',
tertiary_background_color: '#222222',
overlay_background_color: '#000000',
// テキスト色
primary_text_color: '#222222',
secondary_text_color: '#555555',
disabled_text_color: '#999999',
inverse_text_color: '#ffffff',
},
design: {
heading_font_family: 'YuGothic, "Yu Gothic Medium", sans-serif',
main_font_family: 'YuGothic, "Yu Gothic Medium", sans-serif',
special_font_family: 'YuGothic, "Yu Gothic Medium", sans-serif',
design_style: 'modern',
layout_type: 'standard',
},
brand: {
brand_impression: ['professional', 'corporate', 'business'],
industry_characteristics: 'business oriented design',
},
analysis_notes: 'Valid theme for testing',
};
}
/**
* 無効なカラーコードを含むテーマデータを生成
*/
export function createInvalidColorTheme(): ThemeExtractionResult {
const theme = createValidTheme();
return {
...theme,
colors: {
...theme.colors,
primary_color: 'invalid-color',
secondary_color: '#gggggg',
primary_text_color: 'red',
accent_color: '#xyz',
},
};
}
/**
* 低コントラストテーマデータを生成
*/
export function createLowContrastTheme(): ThemeExtractionResult {
const theme = createValidTheme();
return {
...theme,
colors: {
...theme.colors,
primary_text_color: '#cccccc',
primary_background_color: '#ffffff',
secondary_text_color: '#dddddd',
secondary_background_color: '#f5f5f5',
},
};
}
/**
* 境界値テーマデータを生成
*/
export function createBoundaryValueTheme(): ThemeExtractionResult {
const theme = createValidTheme();
return {
...theme,
colors: {
...theme.colors,
primary_color: '#000000',
secondary_color: '#ffffff',
primary_text_color: '#ffffff',
primary_background_color: '#000000',
},
};
}
/**
* パフォーマンステスト用の大きなテーマデータを生成
*/
export function createPerformanceTestTheme(): ThemeExtractionResult {
const theme = createValidTheme();
return {
...theme,
analysis_notes: 'A'.repeat(10000), // 大きなテキストデータ
// カラーは既存のスキーマ準拠のものをそのまま使用
};
}