Skip to content

🧪 Add missing tests for useDashboardStats#384

Merged
is0692vs merged 5 commits into
mainfrom
fix/test-usedashboardstats-17434470686081747157
Jul 7, 2026
Merged

🧪 Add missing tests for useDashboardStats#384
is0692vs merged 5 commits into
mainfrom
fix/test-usedashboardstats-17434470686081747157

Conversation

@is0692vs

@is0692vs is0692vs commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

🎯 What: Added test coverage for previously untested behaviours in the useDashboardStats hook.

📊 Coverage:

  • SWR error handling: Validates that errors are properly captured and defined by the hook.
  • Mutate function: Ensures the mutate function is correctly returned for manual cache invalidation.
  • Edge case handling: Tests the non-finite year parameter scenario (NaN/Infinity), verifying that the network fetch is correctly skipped.

Result: Improved test coverage and ensured the hook behaves predictably in error conditions and handles edge cases appropriately.


PR created automatically by Jules for task 17434470686081747157 started by @is0692vs

Greptile Summary

useDashboardStats フックに対するテストカバレッジを追加するPRです。SWRエラーハンドリング、mutate 関数の存在確認、および非有限値(NaN / Infinity)の年パラメータに対するエッジケースの3種類のテストが新規追加されています。

  • SWRエラーテスト:500エラー時に error.message が正しく設定されることを waitFor で非同期に検証しています。
  • mutate テスト:前回レビューの指摘通り waitFor を除いて同期的に検証する形に修正されています。
  • 非有限年テスト:前回レビューの指摘通り expect(global.fetch).not.toHaveBeenCalled() が追加され、フェッチが実際にスキップされることを直接検証するようになっています。

Confidence Score: 5/5

テストコードのみの追加であり、プロダクションコードへの変更は一切ない。安全にマージできます。

追加された3つのテストはいずれも既存のフック実装と一致しており、モック設定・アサーション・非同期待機の扱いも適切。前回レビューの指摘事項も正しく対応されています。

特に注意が必要なファイルはありません。

Important Files Changed

Filename Overview
src/hooks/tests/useDashboardData.test.tsx useDashboardStats に3つの新規テストを追加。SWRエラー、mutate関数確認、非有限年入力時のフェッチスキップを検証。既存パターンに沿った実装で問題なし。

Reviews (3): Last reviewed commit: "fix: keep dashboard stats test PR scoped" | Re-trigger Greptile

Co-authored-by: is0692vs <135803462+is0692vs@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@vercel

vercel Bot commented Jun 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
github-user-summary Ignored Ignored Jul 7, 2026 11:58am

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@is0692vs, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 58 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: ec6a05c9-c083-41c8-a255-54d93ddd4d3f

📥 Commits

Reviewing files that changed from the base of the PR and between 7b0d050 and 97cde91.

📒 Files selected for processing (1)
  • src/hooks/__tests__/useDashboardData.test.tsx
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/test-usedashboardstats-17434470686081747157

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request adds new unit tests to useDashboardData.test.tsx to cover SWR error handling, the return of the mutate function, and non-finite year inputs. The feedback suggests a safer assertion pattern inside the waitFor block using optional chaining to prevent potential TypeScript compilation errors under strict null checks.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/hooks/__tests__/useDashboardData.test.tsx Outdated
@codecov

codecov Bot commented Jun 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Comment thread src/hooks/__tests__/useDashboardData.test.tsx
Comment thread src/hooks/__tests__/useDashboardData.test.tsx Outdated
@is0692vs

is0692vs commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

@greptile review

Co-authored-by: is0692vs <135803462+is0692vs@users.noreply.github.com>
@pull-request-size pull-request-size Bot added size/L and removed size/M labels Jul 7, 2026
@pull-request-size pull-request-size Bot added size/M and removed size/L labels Jul 7, 2026
@is0692vs

is0692vs commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

@greptile review

@pull-request-size pull-request-size Bot added size/L and removed size/M labels Jul 7, 2026
@is0692vs is0692vs force-pushed the fix/test-usedashboardstats-17434470686081747157 branch from 24e61be to 97cde91 Compare July 7, 2026 11:59
@pull-request-size pull-request-size Bot added size/M and removed size/L labels Jul 7, 2026
@is0692vs is0692vs merged commit 30c8397 into main Jul 7, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant