Skip to content

fix: repair failing tests across utility library#219

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2597-1781802772
Open

fix: repair failing tests across utility library#219
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2597-1781802772

Conversation

@stooit

@stooit stooit commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all 16 failing tests across the TypeScript utility library. All 60 tests now pass with no dependencies added and no test files modified.

Changes

  • src/calculator.tsdivide now throws "Division by zero" instead of returning Infinity.
  • src/date-utils.tsformatRelative uses Math.round for day count, fixing the off-by-one (36h → "2 days ago").
  • src/string-utils.ts — implemented truncate (word-boundary aware, ellipsis counts toward maxLength, handles strings shorter than ellipsis) and slugify; fixed wordCount to collapse consecutive whitespace.
  • src/validator.tsisEmail now handles subdomains/long TLDs; isUrl accepts URLs with ports.
  • src/task-manager.ts — implemented remove, update, and sortBy (priority high>medium>low; createdAt oldest first).

Verification

  • bun test60 pass, 0 fail.
  • Independent review pass confirmed all fixes are correct, minimal, and introduce no regressions.

Assumptions / notes

  • Per the "fix only what tests require" constraint, a pre-existing latent edge case in formatRelative (23h59m renders as "24 hours ago" rather than "1 day ago") was left untouched — not covered by any test, not introduced here. Worth a future follow-up.

- calculator: divide now throws on division by zero
- date-utils: formatRelative rounds days (fixes 36h off-by-one)
- string-utils: implement truncate, slugify; fix wordCount for consecutive spaces
- validator: fix isEmail TLD/subdomain handling, isUrl now accepts ports
- task-manager: implement remove, update, and sortBy methods
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