Skip to content

fix: repair failing tests and implement missing utility functions#220

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2486-1781888213
Open

fix: repair failing tests and implement missing utility functions#220
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2486-1781888213

Conversation

@stooit

@stooit stooit commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all 16 failing tests across the utility library. Test suite now: 60 pass / 0 fail. No test files were modified and no dependencies were added.

Changes

  • calculator.tsdivide now throws on division by zero instead of returning Infinity.
  • string-utils.ts — fixed wordCount to collapse consecutive whitespace; implemented truncate with ellipsis + word-boundary handling.
  • task-manager.ts — completed the missing/incomplete TaskManager methods.
  • date-utils.ts — fixed the off-by-one in formatRelative's day rounding.
  • validator.tsisEmail accepts long TLDs (e.g. .museum); isUrl accepts ports (e.g. http://localhost:3000).

Review hardening

A review pass caught three edge-case regressions in the initial fix (all near tested boundaries, none covered by existing tests) which were corrected:

  • date-utils hours-branch guard no longer rounds, removing a 23.5–24h dead zone.
  • truncate returns an ellipsis at maxLength=3 (boundary budget of 0).
  • truncate no longer discards a word boundary at index 0.

Assumptions

  • Tests are the source of truth for expected behaviour; implementations were aligned to them.
  • Error messages and relative-time wording match the assertions in the test files.

Testing

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

- calculator: divide now throws on division by zero instead of returning Infinity
- string-utils: fix wordCount whitespace splitting, implement truncate with ellipsis and word-boundary handling
- task-manager: complete missing/incomplete TaskManager methods
- date-utils: fix off-by-one in formatRelative day rounding
- validator: isEmail accepts long TLDs, isUrl accepts ports

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