Skip to content

fix: repair failing tests and implement missing utility functionality#238

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2475-1783182483
Open

fix: repair failing tests and implement missing utility functionality#238
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2475-1783182483

Conversation

@stooit

@stooit stooit commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all 16 previously-failing tests across the utility library and implements missing functionality. All 60 tests now pass (0 fail), with no changes to test files and no new dependencies.

Changes by file

  • src/calculator.tsdivide now throws Error("Division by zero") instead of returning Infinity.
  • src/date-utils.ts — fixed off-by-one in formatRelative: uses Math.round on hours→days so 36h ago reads "2 days ago". Removed stale BUG comment.
  • src/string-utils.ts — implemented wordCount handling of multiple consecutive spaces; implemented word-boundary truncate with an ellipsis-aware length budget (output always ≤ maxLength, including small maxLength).
  • src/task-manager.ts — implemented the missing remove, update, and sortBy (priority + createdAt) methods.
  • src/validator.tsisEmail accepts long TLDs (e.g. .museum); isUrl accepts URLs with ports (e.g. http://localhost:3000).

Verification

  • bun test → 60 pass / 0 fail.
  • Reviewed by the review subagent; one non-blocking truncate edge case (maxLength < ellipsis length) was hardened.

Assumptions

  • formatRelative uses rounding (not floor) per the 36-hour test expectation.
  • divide throws only on exact b === 0 (strict).
  • sortBy priority order is high > medium > low; createdAt sorts oldest first, matching the tests.

Constraints honoured

  • No test files modified.
  • No new dependencies added.

- calculator: throw on division by zero instead of returning Infinity
- date-utils: fix off-by-one in formatRelative (round hours-to-days)
- string-utils: implement wordCount consecutive-space handling and
  word-boundary truncate with ellipsis-aware budget
- task-manager: implement remove, update, and sortBy methods
- validator: accept 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