Skip to content

fix: resolve all failing tests across 5 utility modules#167

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/job-e2e-tier1-2419-1779437086
Open

fix: resolve all failing tests across 5 utility modules#167
stooit wants to merge 1 commit into
mainfrom
quantcode/job-e2e-tier1-2419-1779437086

Conversation

@stooit
Copy link
Copy Markdown
Contributor

@stooit stooit commented May 22, 2026

Summary

  • calculator.ts: Throw error on division by zero instead of returning Infinity
  • string-utils.ts: Fix wordCount to handle multiple consecutive spaces; implement truncate function with word-boundary truncation
  • task-manager.ts: Implement missing remove, update, and sortBy methods
  • date-utils.ts: Use Math.round instead of Math.floor for relative day calculation (fixes off-by-one)
  • validator.ts: Allow TLDs of 2+ characters in isEmail; allow port numbers in isUrl

Test Results

All 60 tests pass (previously 16 were failing). No test files were modified.

Assumptions

  • truncate uses word-boundary logic: truncates to fit within maxLength including the "..." suffix
  • sortBy("priority") sorts high > medium > low
  • sortBy("createdAt") sorts oldest first
  • Division by zero throws a generic Error with message "Division by zero"

- calculator: throw error on division by zero instead of returning Infinity
- string-utils: fix wordCount to handle multiple consecutive spaces, implement truncate function
- task-manager: implement remove, update, and sortBy methods
- date-utils: use Math.round instead of Math.floor for relative day calculation
- validator: allow TLDs of 2+ chars 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