Skip to content

fix: resolve all failing tests across utility library#175

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/job-e2e-tier1-2409-1779438964
Open

fix: resolve all failing tests across utility library#175
stooit wants to merge 1 commit into
mainfrom
quantcode/job-e2e-tier1-2409-1779438964

Conversation

@stooit
Copy link
Copy Markdown
Contributor

@stooit stooit commented May 22, 2026

Summary

  • calculator.ts: Throw Error("Division by zero") when divisor is 0 instead of returning Infinity
  • string-utils.ts: Fix wordCount to handle multiple consecutive spaces; implement truncate with word-boundary logic
  • 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 longer than 3 chars in email validation; allow port numbers in URL validation

Testing

All 60 tests pass across 5 test files. No test files were modified.

Assumptions

  • truncate truncates at word boundaries with "..." appended, where total length (including "...") does not exceed maxLength
  • sortBy("priority") sorts high > medium > low
  • sortBy("createdAt") sorts oldest first
  • Division by zero throws a generic Error (not a custom error class)

- calculator.ts: throw Error on division by zero instead of returning Infinity
- string-utils.ts: fix wordCount to handle multiple spaces; implement truncate
- task-manager.ts: implement remove, update, and sortBy methods
- date-utils.ts: use Math.round instead of Math.floor for relative day calc
- validator.ts: allow long TLDs in email; allow 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