Skip to content

fix: repair failing tests across utility library#213

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2469-1781580070
Open

fix: repair failing tests across utility library#213
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2469-1781580070

Conversation

@stooit

@stooit stooit commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all 16 previously-failing tests across the 5 source modules. All 60 tests now pass (bun test), with none of the 44 originally-passing tests broken.

Changes

  • src/calculator.tsdivide now throws Error("Division by zero") instead of returning Infinity.
  • src/date-utils.tsformatRelative uses Math.round instead of Math.floor, fixing the off-by-one (36h → "2 days ago").
  • src/string-utils.tswordCount now handles multiple consecutive spaces; truncate implemented for within-limit, word-boundary, ellipsis-budget, and short-string cases.
  • src/task-manager.ts — implemented remove, update (title/priority, returns false for unknown id), and sortBy (priority high→medium→low, createdAt oldest-first).
  • src/validator.tsisEmail allows long TLDs; isUrl accepts URLs with ports.

Verification

  • bun test: 60 pass / 0 fail
  • Independent review pass: no blocking issues; genuine implementations, not test-gaming.

Notes

  • isEmail/isUrl remain intentionally lightweight permissive validators, not full RFC parsers.

Constraints honoured

  • No test files modified. No new dependencies added.

- calculator: divide throws on division by zero
- date-utils: formatRelative uses Math.round (fixes off-by-one at 36h)
- string-utils: fix wordCount for consecutive spaces; implement truncate
- task-manager: implement remove, update, and sortBy methods
- validator: allow long TLDs in isEmail and ports in isUrl
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