Skip to content

fix: implement missing utilities and fix edge-case bugs to pass all tests - #272

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2355-1785515973
Open

fix: implement missing utilities and fix edge-case bugs to pass all tests#272
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2355-1785515973

Conversation

@stooit

@stooit stooit commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Makes all 60 tests pass (was 16 failing). Implemented missing functionality and fixed edge-case bugs across five utility modules. No test files modified, no new dependencies.

Changes

File Fix
src/calculator.ts divide now throws Error("Division by zero") when b === 0 (also catches -0) instead of returning Infinity/NaN.
src/string-utils.ts Implemented truncate (word-boundary cut, "..." counted within maxLength, unchanged when it already fits) and fixed wordCount to collapse consecutive spaces.
src/task-manager.ts Implemented remove/update (return boolean, false for unknown id) and sortBy (priority high>medium>low; createdAt oldest-first, stable).
src/date-utils.ts Fixed formatRelative off-by-one (Math.round instead of Math.floor on the day boundary).
src/validator.ts Fixed isEmail for long TLDs and isUrl for URLs with a port (now uses the URL constructor).

Verification

  • bun test -> 60 pass / 0 fail
  • tsc --noEmit clean

Assumptions

  • Scope was strictly "fix what the tests require." A review pass surfaced several edge cases not covered by the current suite (e.g. formatRelative unit-boundary output, NaN on invalid dates, TaskManager accessors returning live references, truncate with negative maxLength). These are pre-existing/unreachable by tests and were intentionally left out to avoid behaviour changes beyond the test contracts; documented here for a possible hardening follow-up.

Generated with QuantCode Agent

…ests

- calculator: divide throws on division by zero
- string-utils: implement truncate (word-boundary + ellipsis) and fix wordCount
- task-manager: implement remove/update/sortBy methods
- date-utils: fix formatRelative off-by-one (round vs floor)
- validator: fix isEmail long-TLD and isUrl port handling
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