Skip to content

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

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2438-1785001571
Open

fix: implement missing utilities and fix edge-case bugs#264
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2438-1785001571

Conversation

@stooit

@stooit stooit commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all 16 previously-failing tests across the utility library (was 44 pass / 16 fail → now 60 pass / 0 fail). No test files modified, no new dependencies.

Changes by file

  • src/task-manager.ts — implemented three stub methods: remove (Map delete, returns false for unknown id), update (Object.assign merge, returns false for unknown id), and sortBy (priority via {high:0, medium:1, low:2} rank map, or ascending createdAt).
  • src/calculator.tsdivide now throws on division by zero.
  • src/date-utils.ts — relative-time formatting off-by-one: Math.floorMath.round so 36h reports "2 days ago". Added a comment documenting the rounding intent to prevent regression.
  • src/string-utils.ts — implemented truncate (word-boundary truncation with "..." counting toward maxLength; returns unchanged when within limit); fixed wordCount for consecutive spaces.
  • src/validator.tsisEmail accepts long TLDs (e.g. .museum); isUrl accepts an optional port (e.g. http://localhost:3000).

Verification

  • bun test → 60 pass / 0 fail / 70 expect() calls.
  • Reviewed for tests-passing hacks: the Math.round change matches the source's own documented intent (nearest-day semantics), and the validator regex changes were checked against the reject cases the tests expect.

Assumptions

  • Fixed only what the tests require; behaviour matched to test expectations and existing TODO comments in the source.

- task-manager: implement remove, update, and sortBy methods
- calculator: throw on division by zero
- date-utils: round to nearest day for relative formatting (off-by-one)
- string-utils: implement truncate (word-boundary) and fix wordCount
- validator: accept long TLDs in email and optional port in URL

All 60 tests pass (was 44 pass / 16 fail).
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