Skip to content

fix: repair all failing utility-library tests#221

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2419-1781909551
Open

fix: repair all failing utility-library tests#221
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2419-1781909551

Conversation

@stooit

@stooit stooit commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all 16 previously-failing tests across the utility library. The full suite now passes (60 pass / 0 fail).

Changes

  • src/calculator.tsdivide now throws Error("Division by zero") on a zero divisor (b === 0) instead of returning Infinity.
  • src/validator.tsisEmail TLD pattern widened from {2,4} to {2,} (accepts long TLDs); isUrl reimplemented with the URL constructor + protocol check so ports, query strings and fragments validate correctly.
  • src/string-utils.tswordCount splits on /\s+/ after trimming (collapses consecutive spaces); truncate cuts at a word boundary with the "..." ellipsis counting toward maxLength.
  • src/task-manager.tsremove/update return false for unknown IDs; sortBy orders by priority (high → medium → low) and by createdAt (oldest first).
  • src/date-utils.tsformatRelative off-by-one fixed (36h now reports "2 days ago").

Verification

  • bun test60 pass, 0 fail.
  • Independent correctness review confirmed all fixes are genuine implementations, not test-specific over-fits. Two non-blocking nits noted (formatRelative rounding near the ~23h30m boundary; truncate returning input unchanged when maxLength <= 3) — both pre-existing, untested, out of scope.

Assumptions

  • No test files modified; no dependencies added — only src/ changed, per task constraints.

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