Skip to content

fix: repair failing tests across utility library#212

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2463-1781569620
Open

fix: repair failing tests across utility library#212
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2463-1781569620

Conversation

@stooit

@stooit stooit commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all 16 previously-failing tests across 5 source files. All 60 tests now pass; no test files were modified and no dependencies were added.

Changes

  • calculator.tsdivide() now throws on division by zero instead of returning Infinity.
  • date-utils.tsformatRelative() uses Math.round (not Math.floor) when converting hours to days, fixing the off-by-one (e.g. 36h ago → "2 days ago").
  • string-utils.ts — implemented previously-stubbed truncate, wordCount, and slugify.
  • task-manager.ts — implemented missing getByPriority; complete() now sets completedAt and transitions status correctly.
  • validator.ts — fixed isEmail regex to accept long TLDs/subdomains; isUrl now uses the URL constructor so ports/paths/queries validate correctly.

Verification

bun test60 pass / 0 fail. Independently re-run and confirmed.

Review

Reviewed by the review subagent: all fixes are genuine implementations (no hardcoding/overfitting), no regressions, no test files touched.

Assumptions

  • Test files represent the intended contract and are authoritative.
  • Division-by-zero error message text was free to choose (no test asserts the exact string).

- calculator: throw on division by zero instead of returning Infinity
- date-utils: round (not floor) hours-to-days in formatRelative
- string-utils: implement truncate, wordCount, slugify
- task-manager: implement getByPriority and set completedAt on complete
- validator: fix isEmail TLD/subdomain regex and isUrl port handling

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