Skip to content

test: analysis / ai / layout / fetch のテスト拡大 (+35)#57

Merged
Pregum merged 1 commit intomainfrom
test/analysis-and-ai
Apr 23, 2026
Merged

test: analysis / ai / layout / fetch のテスト拡大 (+35)#57
Pregum merged 1 commit intomainfrom
test/analysis-and-ai

Conversation

@Pregum
Copy link
Copy Markdown
Owner

@Pregum Pregum commented Apr 23, 2026

Summary

残っていたテスト薄い領域を網羅。196 → 231 tests (+35)

追加 件数 対象
tests/uiStates.test.ts 新規 9 analyzeUIStates / formatReport の主要パス
tests/designDocExport.test.ts 新規 7 generateDesignDoc の Markdown 構造
tests/aiClients.test.ts 新規 8 requestAIReview / requestAIGenerate の fetch モック
tests/fetchPen.test.ts 新規 6 スキーム検証 / HTTP エラー / CORS ヒント
tests/layout.test.ts +5 space_between / space_around / padding 2/4-tuple / alignItems end

注意点

  • aiClients.test.tsvi.stubEnv('VITE_AI_REVIEW_URL', ...) + vi.resetModules でテストごとに module を読み直し、import.meta.env の値を分離
  • fetchvi.stubGlobal('fetch', vi.fn().mockResolvedValue(...)) で差し替え

Test plan

  • npm test で 18 ファイル / 231 件全 pass
  • npm run build OK

🤖 Generated with Claude Code

196 → 231 tests (+35)

追加:
- tests/uiStates.test.ts 新規 (9)
  analyzeUIStates: 空 / 小フレーム除外 / ideal 推定 / screen グルーピング /
  "WF:" prefix 除去 / full coverage / 非 frame ノードスキップ
  formatReport: en / ja の出力確認
- tests/designDocExport.test.ts 新規 (7)
  Markdown 出力のヘッダ、locale 別、統計、design tokens 有無、空 doc
- tests/aiClients.test.ts 新規 (8)
  isAIXxxEnabled の URL 有無判定、requestAIReview 正常/失敗/statusText fallback、
  requestAIGenerate body 形式 + HTTP status 属性、未設定エラー
  (vi.stubEnv + vi.resetModules で環境変数を分離)
- tests/fetchPen.test.ts 新規 (6)
  javascript:/data: 禁止、相対パス resolve、https 通過、非 ok → HTTP エラー、
  TypeError → CORS ヒント
- tests/layout.test.ts (+5)
  justifyContent: space_between / space_around、padding 2-tuple / 4-tuple、
  alignItems: end

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Pregum Pregum merged commit 5c91021 into main Apr 23, 2026
1 check passed
@Pregum Pregum deleted the test/analysis-and-ai branch April 23, 2026 06:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant