Skip to content

fix: repair failing utility tests and implement missing functions - #268

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2420-1785115348
Open

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

Conversation

@stooit

@stooit stooit commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all 16 failing tests across the utility library (now 60 pass / 0 fail) and implements previously-unimplemented functions. Only source files under src/ were changed — no test files modified, no dependencies added.

Changes

  • calculator.tsdivide throws on division by zero instead of returning Infinity (also catches -0).
  • string-utils.tswordCount collapses consecutive whitespace; truncate implemented to cut at a word boundary with an ellipsis counted toward maxLength.
  • task-manager.ts — implemented remove, update (title/description/priority), and sortBy (priority high>medium>low, non-mutating).
  • date-utils.ts — fixed off-by-one in formatRelative (round instead of floor; 36h → "2 days ago").
  • validator.tsisEmail accepts long TLDs (e.g. .museum); isUrl accepts URLs with a port (e.g. http://localhost:3000).

Verification

  • bun test → 60 pass / 0 fail
  • tsc --noEmit → clean
  • Independent review: approved, no blockers

Assumptions / notes

  • Scope limited to "fix only what the tests require". Review flagged two out-of-scope edge cases (fractional-minute rounding in formatRelative; negative maxLength in truncate) not covered by any test — left unchanged to avoid over-engineering.

🤖 Generated with autonomous agent

- calculator: throw on division by zero instead of returning Infinity
- string-utils: fix wordCount for consecutive spaces; implement truncate at word boundary
- task-manager: implement remove, update, and sortBy methods
- date-utils: fix off-by-one in formatRelative (round instead of floor)
- 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