Skip to content

fix: implement missing utilities and fix edge-case bugs#243

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2293-1783616295
Open

fix: implement missing utilities and fix edge-case bugs#243
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2293-1783616295

Conversation

@stooit

@stooit stooit commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

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

Changes

  • src/string-utils.ts — implemented wordCount (collapses consecutive whitespace via \s+ split after trim) and truncate (returns unchanged if within limit, reserves 3 chars so the ellipsis counts toward maxLength, truncates on the last word boundary, and handles strings shorter than the ellipsis).
  • src/task-manager.ts — implemented remove (returns true/false), update (title/priority, returns false for unknown id), and sortBy for priority (high → medium → low) and createdAt (oldest first).
  • src/validator.ts — fixed isEmail to accept long TLDs (e.g. .museum) and isUrl to accept URLs with a port.
  • src/calculator.tsdivide now throws on division by zero.
  • src/date-utils.ts — fixed off-by-one in relative-day formatting so 36h reads as expected.

Testing

bun test → 60 pass, 0 fail, 70 expect() calls.

Notes / assumptions

  • No test files were modified and no dependencies were added, per task constraints.
  • sortBy("priority") treats high as most-important-first; sortBy("createdAt") returns oldest first — both per the test contracts.

- string-utils: implement wordCount and truncate (word-boundary,
  ellipsis counts toward maxLength)
- task-manager: implement remove, update, and sortBy (priority, createdAt)
- validator: fix isEmail long-TLD and isUrl port handling
- calculator: throw on division by zero
- date-utils: fix off-by-one in relative-day rounding

All 60 tests pass.
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