Skip to content

fix: resolve all 16 failing tests across 5 utility modules#172

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/job-e2e-tier1-2372-1779438246
Open

fix: resolve all 16 failing tests across 5 utility modules#172
stooit wants to merge 1 commit into
mainfrom
quantcode/job-e2e-tier1-2372-1779438246

Conversation

@stooit
Copy link
Copy Markdown
Contributor

@stooit stooit commented May 22, 2026

Summary

  • calculator.ts: Throw Error("Division by zero") when dividing by zero instead of returning Infinity
  • string-utils.ts: Fix wordCount to split on /\s+/ (handles multiple consecutive spaces); implement truncate with word-boundary logic and ... suffix
  • task-manager.ts: Implement remove(id), update(id, changes), and sortBy(field) methods (priority order: high > medium > low; createdAt: oldest first)
  • date-utils.ts: Use Math.round instead of Math.floor for day calculation in formatRelative so 36 hours → 2 days
  • validator.ts: Allow TLDs longer than 4 characters in email regex; accept port numbers in URL validation regex

Testing

All 60 tests pass (bun test). No previously passing tests were broken.

Assumptions

  • truncate uses word-boundary truncation where the ... counts toward maxLength
  • sortBy("priority") orders high > medium > low (descending severity)
  • sortBy("createdAt") orders oldest first (ascending)
  • No test files were modified; no new dependencies added

- calculator: throw on division by zero instead of returning Infinity
- string-utils: fix wordCount to handle multiple spaces; implement truncate
- task-manager: implement remove, update, and sortBy methods
- date-utils: use Math.round for day calculation in formatRelative
- validator: allow longer TLDs in email regex; accept ports in URL validation
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