Skip to content

fix: resolve all failing tests in utility library#166

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/job-e2e-tier1-2471-1779436713
Open

fix: resolve all failing tests in utility library#166
stooit wants to merge 1 commit into
mainfrom
quantcode/job-e2e-tier1-2471-1779436713

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 consecutive spaces); implement truncate with word-boundary logic
  • task-manager.ts: Implement missing remove, update, and sortBy methods
  • date-utils.ts: Use Math.round in formatRelative so 36 hours correctly displays as "2 days ago"
  • validator.ts: Allow long TLDs (e.g. .museum) in isEmail; allow port numbers in isUrl

Test Results

All 60 tests pass across 5 test files (0 failures).

Assumptions

  • truncate truncates at word boundaries and appends "..." within the maxLength budget
  • sortBy("priority") orders high > medium > low
  • sortBy("createdAt") orders oldest first
  • Division by zero throws a generic Error (not a custom error class)

- calculator: throw Error on division by zero instead of returning Infinity
- string-utils: fix wordCount to handle consecutive spaces; implement truncate
- task-manager: implement remove, update, and sortBy methods
- date-utils: use Math.round in formatRelative for correct day rounding
- validator: allow long TLDs in isEmail; allow ports in isUrl
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