Skip to content

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

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2405-1783010622
Open

fix: implement missing utilities and fix edge-case bugs#236
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2405-1783010622

Conversation

@stooit

@stooit stooit commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Makes all 16 previously-failing tests pass (now 60 pass / 0 fail) without modifying any test files or adding dependencies. Only source files under src/ were changed.

Changes by file

  • src/string-utils.tswordCount now trims and splits on \s+ so consecutive spaces don't produce empty tokens; implemented truncate (returns unchanged within limit, breaks at word boundary within the maxLength - ellipsis budget, ellipsis counts toward the limit).
  • src/task-manager.ts — implemented remove (returns false for unknown id), update (title/priority, returns false for unknown id), and sortBy for priority (high → medium → low) and createdAt (oldest first).
  • src/validator.tsisEmail accepts long TLDs (e.g. .museum); isUrl correctly handles URLs with a port.
  • src/calculator.tsdivide throws on division by zero.
  • src/date-utils.ts — fixed formatRelative off-by-one: tier selection now branches on the rounded magnitude so boundary cases (23.5h, 59.5min) roll up correctly instead of rendering "24 hours"/"60 minutes".

Verification

  • bun test: 60 pass, 0 fail (70 assertions).
  • No files under test/ were modified; no dependencies added.
  • Reviewed by the review subagent, which flagged one boundary defect in the initial formatRelative fix — that was corrected before this PR.

Assumptions

  • The tests are the source of truth for intended API/edge-case behaviour.
  • formatRelative tier rounding was corrected to be internally consistent, a small behavioural improvement beyond the minimum required by the failing test.

…ests

- string-utils: fix wordCount on consecutive spaces; implement truncate
- task-manager: implement remove, update, and sortBy (priority/createdAt)
- validator: accept long TLDs in isEmail; fix isUrl port handling
- calculator: throw on division by zero
- date-utils: fix formatRelative tier-boundary rounding (off-by-one)

All 60 tests pass. No test files or dependencies modified.
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