Skip to content

fix: repair 16 failing tests across utility library - #276

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

fix: repair 16 failing tests across utility library#276
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2154-1785776046

Conversation

@stooit

@stooit stooit commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all 16 failing tests across five source files. Suite now: 60 pass / 0 fail, bunx tsc --noEmit exits 0. No test files modified, no dependencies added.

Changes

  • src/calculator.tsdivide throws on a zero divisor (was returning Infinity). Covers 0 and -0.
  • src/string-utils.tswordCount splits on /\s+/ after trim() (collapses consecutive whitespace); truncate implemented (was a stub): word-boundary truncation with "..." counted toward maxLength, returns input unchanged when within limit.
  • src/task-manager.tsremove delegates to Map.delete; update applies present fields in place with per-key !== undefined guards, returns false for unknown ids; sortBy uses an exhaustive switch with Record order tables, sorts a copy (Map order preserved), relies on stable sort for equal createdAt.
  • src/date-utils.tsformatRelative day count uses Math.round(Math.abs(diffHours) / 24), fixing the off-by-one (36h → "2 days ago").
  • src/validator.tsisEmail TLD quantifier relaxed {2,4}{2,}; isUrl drops the port === "" clause (protocol check and try/catch retained).

Verification

  • bun test → 60 pass / 0 fail
  • bunx tsc --noEmit → exit 0
  • Independent code review: approved, no blockers.

Notes / assumptions

  • Stale // BUG: / // TODO: comments cleared where fixed.
  • Non-blocking items left as-is by design (reviewer-noted): sortBy has no default (union-guarded by TS); update treats description: undefined as a no-op; isUrl now admits explicit ports (required by tests). None affect the test contract.

…tion

Implement truncate/remove/update/sortBy and fix off-by-one day rounding,
over-restrictive email TLD and URL port rejection. 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