Skip to content

Conversation

@unkosan
Copy link
Owner

@unkosan unkosan commented Mar 28, 2025

Added test for trainers

Summary by CodeRabbit

- Test: フロントエンドのカスタムフック(例: `usePreprocessSelexData`, `useSubmitJob`, `useVaeJobs`)に対する包括的なユニットテストを追加。
- Refactor: CSVダウンロード処理を`downloadFileFromText`ユーティリティ関数に置き換え、コードの保守性を向上。
- Bug fix: `usePreprocessSelexData`フックで`router.push`後の不要なコード実行を防止。
- Documentation: テストポリシーを更新し、`testing-library/react-hooks`の使用を禁止。

@github-actions
Copy link

github-actions bot commented Mar 28, 2025

Image description CodeRabbit

ウォークスルー

このプルリクエストでは、フロントエンドのカスタムフックやコンポーネントに対するテストの追加、エラーハンドリングやロジックの改善、CSVダウンロード処理のリファクタリングが行われています。ReduxやAPIクライアントのモックを活用し、コードの保守性とテストカバレッジを向上させています。

変更点

ファイル 変更内容
frontend/.clinerules テストポリシーを更新し、testing-library/react-hooksの使用を禁止。
frontend/components/trainer-add/navigator-preprocess/hooks/__tests__/use-pagenation.test.tsx, frontend/components/trainer-add/navigator-preprocess/hooks/use-pagenation.tsx usePreprocessSelexDataフックのテストを追加し、router.push後のコード実行を防ぐためのreturnを追加。
frontend/components/trainer-add/preprocessing-forms/hooks/__tests__/use-preprocessing-params.test.tsx, frontend/components/trainer-add/preprocessing-forms/hooks/use-preprocessing-params.tsx usePreprocessingParamsuseModelTypeSelectionフックのテストを追加し、エラーハンドリングを強化。
frontend/components/trainer-add/navigator-train/hooks/__tests__/use-submit-job.test.tsx useSubmitJobフックのテストを追加し、APIやナビゲーションの動作を検証。
frontend/components/trainer-add/train-parameters-forms/hooks/__tests__/use-train-parameters.test.tsx useTrainParametersなど複数フックのテストを追加し、パラメータ変更や状態更新を検証。
frontend/components/trainer-add/upload-file/hooks/__tests__/use-upload-file.test.tsx useUploadFileフックのテストを追加し、ファイルアップロードやエラーハンドリングを検証。
frontend/components/trainer-home/hooks/__tests__/use-job-item.test.tsx useJobItemフックのテストを追加し、データ取得やエラーハンドリングを検証。
frontend/components/trainer-home/latent-graph/hooks/__tests__/use-graph-config.test.tsx, frontend/components/trainer-home/latent-graph/hooks/__tests__/use-latent-space-plots.test.tsx, frontend/components/trainer-home/latent-graph/hooks/use-latent-space-plots.tsx グラフ関連フックのテストを追加し、CSVダウンロード処理をリファクタリング。
frontend/components/trainer-home/losses-graph/hooks/__tests__/use-losses-graph.test.tsx, frontend/components/trainer-home/losses-graph/hooks/use-losses-graph.tsx, frontend/components/trainer-home/losses-graph/index.tsx 損失グラフのフックとコンポーネントをリファクタリングし、テストを追加。
frontend/components/trainer-home/vae-jobs-list/hooks/__tests__/use-child-job-card.test.ts, frontend/components/trainer-home/vae-jobs-list/hooks/__tests__/use-job-card.test.ts, frontend/components/trainer-home/vae-jobs-list/hooks/__tests__/use-vae-jobs.test.ts, frontend/components/trainer-home/vae-jobs-list/hooks/use-vae-jobs.ts ジョブリスト関連フックのテストを追加し、duration計算ロジックを修正。

Uplevel your code reviews with CodeRabbit Pro

CodeRabbit Pro

If you like this project, please support us by purchasing the Pro version. The Pro version has advanced context, superior noise reduction and several proprietary improvements compared to the open source version. Moreover, CodeRabbit Pro is free for open source projects.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

Commits Files that changed from the base of the PR and between 4c27884 and 1be760c commits.
Files selected (19)
  • frontend/.clinerules (1)
  • frontend/components/trainer-add/navigator-preprocess/hooks/tests/use-pagenation.test.tsx (1)
  • frontend/components/trainer-add/navigator-preprocess/hooks/use-pagenation.tsx (1)
  • frontend/components/trainer-add/navigator-train/hooks/tests/use-submit-job.test.tsx (1)
  • frontend/components/trainer-add/preprocessing-forms/hooks/tests/use-preprocessing-params.test.tsx (1)
  • frontend/components/trainer-add/preprocessing-forms/hooks/use-preprocessing-params.tsx (1)
  • frontend/components/trainer-add/train-parameters-forms/hooks/tests/use-train-parameters.test.tsx (1)
  • frontend/components/trainer-add/upload-file/hooks/tests/use-upload-file.test.tsx (1)
  • frontend/components/trainer-home/hooks/tests/use-job-item.test.tsx (1)
  • frontend/components/trainer-home/latent-graph/hooks/tests/use-graph-config.test.tsx (1)
  • frontend/components/trainer-home/latent-graph/hooks/tests/use-latent-space-plots.test.tsx (1)
  • frontend/components/trainer-home/latent-graph/hooks/use-latent-space-plots.tsx (4)
  • frontend/components/trainer-home/losses-graph/hooks/tests/use-losses-graph.test.tsx (1)
  • frontend/components/trainer-home/losses-graph/hooks/use-losses-graph.tsx (3)
  • frontend/components/trainer-home/losses-graph/index.tsx (2)
  • frontend/components/trainer-home/vae-jobs-list/hooks/tests/use-child-job-card.test.ts (1)
  • frontend/components/trainer-home/vae-jobs-list/hooks/tests/use-job-card.test.ts (1)
  • frontend/components/trainer-home/vae-jobs-list/hooks/tests/use-vae-jobs.test.ts (1)
  • frontend/components/trainer-home/vae-jobs-list/hooks/use-vae-jobs.ts (1)
Files not reviewed due to errors (4)
  • frontend/components/trainer-home/losses-graph/hooks/use-losses-graph.tsx (no response)
  • frontend/components/trainer-home/vae-jobs-list/hooks/tests/use-job-card.test.ts (no response)
  • frontend/components/trainer-home/vae-jobs-list/hooks/use-vae-jobs.ts (no response)
  • frontend/components/trainer-home/vae-jobs-list/hooks/tests/use-child-job-card.test.ts (no response)
Files skipped from review due to trivial changes (1)
  • frontend/.clinerules
Review comments generated (71)
  • Review: 12
  • LGTM: 59

Tips

Chat with Image description CodeRabbit Bot (@coderabbitai)

  • Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
  • Invite the bot into a review comment chain by tagging @coderabbitai in a reply.

Code suggestions

  • The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
  • You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.

Pausing incremental reviews

  • Add @coderabbitai: ignore anywhere in the PR description to pause further reviews from the bot.

@unkosan unkosan merged commit 8ec5898 into dev Mar 28, 2025
2 checks passed
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.

2 participants