Skip to content

fix: implement missing utilities and fix edge-case bugs#228

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2454-1782518834
Open

fix: implement missing utilities and fix edge-case bugs#228
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2454-1782518834

Conversation

@stooit

@stooit stooit commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all 16 previously-failing tests across the utility library. 60/60 tests now pass, 0 failures. No test files modified, no dependencies 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+ to handle consecutive whitespace; truncate() implemented (trims to word boundary)
src/task-manager.ts Completed missing/incomplete TaskManager methods to match test expectations
src/date-utils.ts Fixed formatRelative off-by-one (floor vs round) and made the hours/days rounding boundary consistent so "24 hours ago" can never display
src/validator.ts isUrl() now accepts URLs with ports (e.g. http://localhost:3000) and other edge cases

Verification

  • bun test -> 60 pass / 0 fail
  • Changes reviewed for genuine implementations (no overfit/hardcoded test-input hacks)
  • An additional rounding-boundary edge case flagged in review was tightened in formatRelative

Assumptions

  • Behaviour was inferred from the existing test expectations; implementations match those contracts rather than introducing new public API.

- calculator: divide() now throws on division by zero
- string-utils: fix wordCount whitespace handling, implement truncate
- task-manager: complete missing/incomplete TaskManager methods
- date-utils: fix formatRelative off-by-one and rounding boundary
- validator: fix isUrl to accept ports and other edge cases

All 60 tests pass.
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