Skip to content

fix: resolve all failing tests in utility library#216

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2338-1781683760
Open

fix: resolve all failing tests in utility library#216
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2338-1781683760

Conversation

@stooit

@stooit stooit commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixed 16 failing tests across 5 utility modules. All 60 tests now pass (0 fail), with no changes to test files and no new dependencies.

Changes

  • src/calculator.tsdivide() now throws Error("Division by zero") when the divisor is 0 instead of silently returning Infinity.
  • src/string-utils.tswordCount() now trims and splits on /\s+/ so consecutive spaces don't produce empty tokens; truncate() implemented.
  • src/task-manager.ts — implemented the missing/incomplete TaskManager methods (remove, update, query by priority, overdue).
  • src/date-utils.ts — fixed off-by-one in formatRelative (Math.floorMath.round), so e.g. 36 hours ago renders as "2 days ago".
  • src/validator.tsisUrl() accepts URLs with ports (uses new URL() with no port restriction); isEmail() accepts TLDs of length ≥ 2 via [a-zA-Z]{2,}.

Verification

  • bun test60 pass, 0 fail (70 assertions).
  • Reviewed for behaviour regressions. An initial review flagged the isUrl/isEmail implementations as weakened, but a verification pass against the actual source confirmed those were false positives — the live code uses the robust new URL() parser and a correct TLD bound.

Assumptions

  • Expected behaviours were derived strictly from the existing test assertions; no test files were modified.

- calculator: divide() throws on division by zero instead of returning Infinity
- string-utils: fix wordCount whitespace handling and implement truncate
- task-manager: implement remove/update/getByPriority/getOverdue
- date-utils: fix off-by-one in formatRelative (round instead of floor)
- validator: accept URLs with ports and longer email TLDs
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