Skip to content

fix: implement missing utilities and fix edge-case bugs - #259

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2531-1784911165
Open

fix: implement missing utilities and fix edge-case bugs#259
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2531-1784911165

Conversation

@stooit

@stooit stooit commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all 16 previously failing tests across the utility library — implementing missing functionality and correcting edge-case bugs. All 60 tests now pass (0 fail); no test files were modified and no dependencies were added.

Changes by file

  • src/calculator.tsdivide now throws on division by zero instead of returning Infinity.
  • src/date-utils.tsformatRelative uses round semantics so 36h → "2 days ago"; hour value capped at 23 to avoid emitting "24 hours ago".
  • src/string-utils.tswordCount collapses consecutive whitespace ("hello world" → 2); truncate implemented (word-boundary truncation, "..." counts toward maxLength, leading-space handling).
  • src/validator.tsisEmail accepts long TLDs (.museum); isUrl accepts URLs with ports (http://localhost:3000).
  • src/task-manager.ts — implemented remove, update, and sortBy (priority high>medium>low, createdAt oldest-first, status).

Testing

bun test60 pass, 0 fail.

Notes / assumptions

  • Fixed only what the tests require, plus two low-risk hardening tweaks flagged in review (truncate leading-space trim, hour cap) — both verified against the full suite.
  • Changes were reviewed by a code-review pass and confirmed sound.

🤖 Generated autonomously.

- calculator: divide now throws on division by zero
- date-utils: formatRelative uses round semantics (36h -> 2 days), caps hours at 23
- string-utils: wordCount collapses consecutive spaces; implement truncate at word boundary
- validator: isEmail accepts long TLDs; isUrl accepts URLs with ports
- task-manager: implement remove, update, and sortBy methods

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