Skip to content

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

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2290-1784478335
Open

fix: implement missing utilities and fix edge-case bugs#254
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2290-1784478335

Conversation

@stooit

@stooit stooit commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all 16 failing tests across the utility library. 60/60 tests now pass, none previously-passing were broken. Only source files were changed — no test files or dependencies were touched.

Changes

File Fix
src/calculator.ts divide() throws Error("Division by zero") when the divisor is 0 instead of returning Infinity.
src/string-utils.ts Implemented truncate() — truncates at the last word boundary with "..." counting toward maxLength, returns the string unchanged when str.length <= maxLength. Made wordCount() robust to tabs/newlines/multiple spaces.
src/task-manager.ts Implemented the missing/incomplete remove, update, and sortBy TaskManager methods.
src/date-utils.ts formatRelative() off-by-one fixed by using Math.round semantics (e.g. 36h → "2 days ago").
src/validator.ts Fixed isEmail regex and isUrl edge cases so the asserted inputs validate correctly.

Verification

  • `bun test` → 60 pass, 0 fail.
  • Independent review pass (verdict: COMMENT / no blockers).

Assumptions & notes

  • Scope kept to exactly what the tests require.
  • Non-blocking follow-ups flagged in review (pre-existing, untested edge cases — not regressions): `formatRelative` half-unit boundaries; `isEmail` consecutive-dot/IP-literal acceptance.

- calculator: divide by zero now throws instead of returning Infinity
- string-utils: implement truncate (word-boundary + ellipsis); robust wordCount
- task-manager: implement remove/update/sortBy methods
- date-utils: use Math.round for relative-time formatting (off-by-one fix)
- validator: fix isEmail regex and isUrl edge cases

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