Skip to content

fix: resolve all failing tests in utility library#208

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2490-1781493739
Open

fix: resolve all failing tests in utility library#208
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2490-1781493739

Conversation

@stooit

@stooit stooit commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all 16 failing tests across the 5 utility modules. The full suite now passes (60 pass / 0 fail). No test files were modified and no dependencies were added.

Changes

File Fix
src/calculator.ts divide now throws Error("Division by zero") instead of returning Infinity
src/string-utils.ts wordCount splits on /\s+/ so consecutive spaces count as one separator; truncate implemented with word-boundary truncation where the "..." ellipsis counts toward maxLength
src/task-manager.ts Implemented remove (returns false for unknown id), update (returns false for unknown id, applies provided fields), and sortBy (priority: high→medium→low; createdAt: oldest first)
src/date-utils.ts formatRelative uses Math.round for the days calculation, fixing the off-by-one (36h → "2 days ago")
src/validator.ts isEmail accepts long TLDs ({2,}); isUrl accepts URLs with ports

Verification

  • bun test → 60 pass, 0 fail, 70 expect() calls
  • Independent review confirmed all fixes correct with no blockers

Assumptions

  • Scope limited to what the tests require, per task constraints. A review flagged two pre-existing, untested edge cases (formatRelative rounding at the 12–24h boundary; truncate behaviour when maxLength < 3) — left unchanged to avoid altering behaviour the test suite does not exercise.

- calculator: throw on division by zero instead of returning Infinity
- string-utils: wordCount handles consecutive spaces; implement truncate
- task-manager: implement remove, update, and sortBy methods
- date-utils: round days in formatRelative to fix off-by-one
- validator: accept long TLDs and URLs with ports
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.

1 participant