Skip to content

fix: repair failing tests across utility library#244

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2568-1783702008
Open

fix: repair failing tests across utility library#244
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2568-1783702008

Conversation

@stooit

@stooit stooit commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all 16 previously failing tests across the TypeScript utility library. All 60 tests now pass (0 fail), with none of the 44 previously-passing tests broken. No test files were modified and no dependencies were added.

Changes

  • src/calculator.tsdivide now throws on division by zero instead of returning Infinity.
  • src/string-utils.tswordCount now handles consecutive whitespace correctly (splits on /\s+/ after trim); truncate implemented to cut at a word boundary with the ellipsis counting toward maxLength.
  • src/task-manager.ts — implemented the previously-stubbed remove, update, and sortBy methods.
  • src/date-utils.ts — fixed off-by-one in formatRelative (rounds instead of floors, so 36h → "2 days ago").
  • src/validator.tsisEmail now accepts long TLDs (e.g. .museum); isUrl now accepts an optional port (e.g. http://localhost:3000).
  • Removed stale BUG: JSDoc comments that described the now-fixed behaviour.

Assumptions

  • Interpreted each fix strictly against the behaviour the tests assert; left edge cases not covered by tests unchanged to avoid regressing passing tests (per "fix only what the tests require").
  • divide throws a generic Error("Division by zero") — no specific error type was mandated by the tests.

Testing

bun test60 pass, 0 fail (70 expect() calls, 5 files).

Reviewed by the review subagent; no blocking issues found.

- calculator: throw on division by zero instead of returning Infinity
- string-utils: fix wordCount for consecutive whitespace; implement truncate at word boundary
- task-manager: implement remove, update, and sortBy methods
- date-utils: fix off-by-one in formatRelative (round instead of floor)
- validator: allow long TLDs in isEmail and ports in isUrl
- remove stale BUG comments now that behaviour is fixed
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