Skip to content

Latest commit

 

History

History
56 lines (43 loc) · 2.52 KB

File metadata and controls

56 lines (43 loc) · 2.52 KB

Phase 2: ArticleList リファクタリング & Container Tests

システム全体のテスト刷新における Phase 2 が完了しました。Content Browser 内の ArticleList コンポーネントに焦点を当てて作業を行いました。

変更点 (Changes)

1. ArticleList リファクタリング

  • DI & 抽象化 (DI & Abstraction):
    • localStorage 操作、削除用 fetchlocation.reload などの副作用を、新しいカスタムフック useArticleListServices に分離しました。
    • ロジックと表示を分離するため、ViewComponent プロパティを導入しました。
    • useRepository, useContentConfig, useRepoContent フックを Dependency Injection (DI) できるようにサポートを追加しました。
  • 参照の安定性 (Reference Stability):
    • 無限レンダリングループを防ぐため、useArticleListServices の戻り値をメモ化しました。

2. コンテナテスト (Container Testing)

  • 新しいテストファイル: src/app/features/content-browser/ArticleList_Binding.test.tsx
  • カバーされたシナリオ:
    • データ読み込み (Data Loading): localStorage からの下書きとリモートファイルが正しく結合されることを検証。
    • View 統合 (View Integration): 正しいプロパティ(ファイルリスト、ハンドラ)が ViewComponent に渡されることを確認。
    • 削除フロー (Deletion Flow): 削除リクエストと確認フロー、および API サービスが正しく呼び出されることをテスト。
  • テストパターン:
    • useLoading に必要なコンテキストを提供するため、HeaderProvider を使用しました。
    • 型安全性のため、テストモックには正確な型 (FileItem, GitHubFile) を使用しました。
    • Deno での React DOM テストの挙動に対応するため、サニタイズ設定 (sanitizeOps, sanitizeResources) を無効化しました。

検証結果 (Verification Results)

ArticleList Container Logic

  • Loads data and renders view with correct props: PASSED
  • Combines drafts and filtered files: PASSED
  • Deletes file via service: PASSED

回帰テスト (Regression Tests)

  • ContentBrowser.test.tsx (Integration): PASSED

次のステップ (Next Steps)

  • Phase 3: Branch & Auth のリファクタリング (BranchManagement.tsx, useAuth, Login.tsx) に進みます。