Closed ju-ki closed 2 months ago
この変更では、フロントエンドのテスト体制を強化し、APIからのデータ取得を効率化しました。新たなテストファイルが追加され、既存のテストが整備されました。また、Jest設定ファイルの導入により、テストの実行環境が整い、TypeScriptの型安全性が向上しました。これらの変更により、コンポーネントの信頼性と開発プロセスの改善が図られています。
ファイル | 変更概要 |
---|---|
.github/workflows/.../blog-site.yml |
テストジョブの名前とコマンドを修正し、bun test からbun run test に変更。 |
frontend/__test__/pages/PostCard.spec.tsx |
PostCard コンポーネントのユニットテストを追加し、タイトルやタグ、コンテンツの表示を確認。 |
frontend/__test__/pages/Posts.spec.tsx |
Posts コンポーネントのテストスイートを整理し、APIからのデータ取得とエラーハンドリングを確認。 |
frontend/jest.config.ts |
Jest設定ファイルを追加し、Next.jsアプリ向けに設定を構成。 |
frontend/jest.setup.ts |
Jestの設定を初期化し、DOM要素のテストのために@testing-library/jest-dom を導入。 |
frontend/package.json |
テストスクリプトを追加し、依存関係を更新。型安全性とテストサポートを強化。 |
frontend/src/components/Posts/Card/index.tsx |
PostCard の表示内容を更新し、記事のコンテンツの表示方法を変更。 |
frontend/src/hooks/api/posts/index.ts |
APIからポストデータを取得する新しい非同期関数fetchAllPosts を導入し、型安全性を確保。 |
frontend/src/pages/posts.tsx |
API取得方法をカスタムフックに変更し、ポストデータの型をArticle に更新。 |
frontend/tsconfig.json |
include 配列にjest.setup.ts を追加し、テストサポートを強化。 |
sequenceDiagram
participant User
participant PostsComponent
participant fetchAllPosts
participant API
User->>PostsComponent: ポストを表示リクエスト
PostsComponent->>fetchAllPosts: API呼び出し
fetchAllPosts->>API: ポストデータ要求
API-->>fetchAllPosts: ポストデータ返却
fetchAllPosts-->>PostsComponent: データ返却
PostsComponent->>User: ポスト表示
🐇 変わる世界、うさぎの耳に
新しいテストで、心は弾む
フロントのコンポーネント、もっとしっかり
型の安全、安心の道を行く
みんなで高める、開発の舞台
さあ、楽しいコードを共に書こう!
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
@coderabbitai review
This PR is automatically created by GitHub Actions
Summary by CodeRabbit
新機能
PostCard
コンポーネントのユニットテストを追加しました。Posts
コンポーネントのテストを再構築し、APIとの相互作用を検証しました。package.json
に追加しました。バグ修正
PostCard
コンポーネントのコンテンツの表示方法を改善しました。ドキュメント