fix(test): resolve 14 S5906 + 2 S5914 SonarQube smells (#160)#172
Conversation
…+ toBeUndefined)
S5906: replace .length.toBe(N) with toHaveLength(N) across 9 test
files (financeiro-client, WorkoutSession, dashboard-nav,
card-feedback, workout-editor, columns, circular-progress,
exercise-options, nan-guards). Replace .toBeGreaterThan(0) with
.toBeGreaterThanOrEqual(1) for clarity.
S5914: replace .toBe(undefined) with .toBeUndefined() in
nan-guards.test.ts. Line 29 (.toBe('')) is correct — not a smell.
Closes #160.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (9)
WalkthroughTest files across dashboard, workout, and library modules were updated to replace direct ChangesTest Matcher Style Updates
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|



Closes #160.
14 S5906 —
toHaveLengthAll
expect(X.length).toBe(N)replaced withexpect(X).toHaveLength(N)..toBeGreaterThan(0)replaced with.toBeGreaterThanOrEqual(1)(matching S5906).Files: financeiro-client.test.tsx (2), WorkoutSession.test.tsx (2),
dashboard-nav.test.tsx (1), card-feedback.test.tsx (1),
workout-editor.test.tsx (1), columns.test.tsx (1),
circular-progress.test.tsx (1), exercise-options.test.ts (8),
nan-guards.test.ts (0 — none).
2 S5914 —
toBeUndefinednan-guards.test.ts:28:'.toBe(undefined)'→'.toBeUndefined()'.Line 29
('.toBe("")')is correct — not a smell.Verification
npm run test: 1103/1103 passnpm run typecheck: 0 errorsSummary by cubic
Fixes SonarQube smells in the test suite (S5906, S5914) to use idiomatic Jest matchers for clearer, more consistent assertions. No runtime behavior changes.
toHaveLength(N)instead ofexpect(X.length).toBe(N)and replace> 0checks withtoBeGreaterThanOrEqual(1).toBeUndefined()instead oftoBe(undefined)innan-guards.test.ts.Written for commit 9b781a6. Summary will update on new commits.
Summary by CodeRabbit