Skip to content

Conversation

@gitauto-for-dev
Copy link
Contributor

@gitauto-for-dev gitauto-for-dev bot commented Jan 18, 2026

Resolves #604

Summary

Add comprehensive unit tests for utils/format-percentage.ts to reach 100% line, statement, function, and branch coverage.

Test Patterns

  • Formats typical numeric inputs to percentage strings (integers and decimals)
  • Rounding behavior at common thresholds (e.g., 0.5 up/down) and specified precision (if supported)
  • Boundary values: 0, 1, 100, and very small/large numbers
  • Negative values formatting and sign handling
  • Behavior for out-of-range inputs (e.g., <0, >100 or >1 depending on implementation), including clamping vs. pass-through (as implemented)
  • Handling of invalid inputs: NaN, Infinity, null/undefined, non-number types; verifies thrown errors or fallbacks as implemented
  • Trailing zeros behavior and precision options (if supported)
  • Idempotency with already-formatted strings (e.g., inputs containing “%”), when applicable
  • Ensures all conditional branches and edge cases in utils/format-percentage.ts are executed and asserted
git fetch origin
git checkout gitauto-wes/issue-604-20260118-181442-Dong
git pull origin gitauto-wes/issue-604-20260118-181442-Dong

@hiroshinishio hiroshinishio merged commit 8b24f11 into main Jan 18, 2026
1 check passed
@hiroshinishio hiroshinishio deleted the gitauto-wes/issue-604-20260118-181442-Dong branch January 18, 2026 10:49
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.

Low Test Coverage: utils/format-percentage.ts

2 participants