Skip to content

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

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2154-1786465361
Open

fix: implement missing utilities and fix edge-case bugs#282
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2154-1786465361

Conversation

@stooit

@stooit stooit commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Makes the full bun test suite pass (60/60, up from 44 pass / 16 fail) by implementing missing functions and fixing edge-case bugs across five source files. No test files were modified and no dependencies were added.

Changes

  • src/calculator.tsdivide now throws on division by zero instead of returning Infinity.
  • src/string-utils.tswordCount collapses consecutive whitespace; truncate implemented with word-boundary truncation + ellipsis, guarding against leading-whitespace content loss and never exceeding maxLength.
  • src/task-manager.ts — implemented remove, update, and sortBy (priority high>medium>low, status ordering, createdAt oldest-first). sortBy has a throwing default so an unknown field fails at the boundary rather than returning undefined.
  • src/date-utils.tsformatRelative uses Math.round so 36h reads "2 days ago".
  • src/validator.tsisEmail accepts long TLDs and subdomains; isUrl accepts URLs with a port.

Verification

  • bun test: 60 pass / 0 fail (70 expect() calls)
  • tsc --noEmit: clean (exit 0)
  • Only the 5 source files changed; no test files touched.

Review notes / assumptions

  • Reviewed via the review subagent; three uncovered edge cases fixed in follow-up (truncate whitespace loss, sortBy default, truncate never exceeds maxLength).
  • update(id, { description: undefined }) is intentionally a no-op; explicit "" still clears.
  • Future work: isEmail is a pragmatic regex, not RFC 5322-compliant — use a confirmation-link round-trip as the trust boundary if gating account creation.

🤖 Generated autonomously.

- calculator: divide throws on division by zero instead of returning Infinity
- string-utils: wordCount collapses consecutive whitespace; implement truncate
  with word-boundary + ellipsis, guarding against leading-whitespace content loss
- task-manager: implement remove, update, and sortBy (with exhaustive default)
- date-utils: formatRelative uses Math.round so 36h rounds to '2 days ago'
- validator: isEmail accepts long TLDs/subdomains; isUrl accepts URLs with port

All 60 tests pass; typecheck clean.
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