Skip to content

fix: resolve all failing tests across utility modules#205

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2455-1781284245
Open

fix: resolve all failing tests across utility modules#205
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2455-1781284245

Conversation

@stooit

@stooit stooit commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all 16 failing tests across the utility library. All 60 tests now pass (0 failures), with no previously-passing tests broken and no new dependencies added.

Changes

  • src/calculator.tsdivide now throws Error("Division by zero") instead of returning Infinity.
  • src/date-utils.tsformatRelative now uses Math.round (was Math.floor) for the hours-to-days conversion, fixing the off-by-one (36h → "2 days ago").
  • src/string-utils.ts — implemented truncate (ellipsis counts toward maxLength, word-boundary truncation, returns unchanged when within limit, handles strings shorter than the ellipsis) and fixed wordCount to collapse consecutive whitespace.
  • src/task-manager.ts — implemented/completed remove, update, and sortBy (by priority high→medium→low, and by createdAt oldest-first).
  • src/validator.tsisEmail now accepts long TLDs (e.g. user@example.museum); isUrl now accepts URLs with a port (e.g. http://localhost:3000) via the URL constructor.

Testing

bun test60 pass, 0 fail.

Notes / assumptions

  • Test files were not modified.
  • A reviewer noted a pre-existing cosmetic edge in formatRelative (a date ~23.5h ago can render as "24 hours ago"); this predates the change, is not covered by any test, and was left out of scope per the "fix only what the tests require" constraint.

- calculator: throw on division by zero instead of returning Infinity
- date-utils: round (not floor) hours-to-days in formatRelative
- string-utils: implement truncate word-boundary logic and fix wordCount
- 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