Skip to content

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

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/job-e2e-tier1-2366-1779438164
Open

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

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 with word-boundary logic
  • task-manager.ts: Implement remove, update, and sortBy methods
  • date-utils.ts: Use Math.round for day calculation in formatRelative (fixes 36h showing as "1 day ago" instead of "2 days ago")
  • validator.ts: Allow long TLDs (e.g. .museum) in isEmail; allow ports on hostnames without dots (e.g. localhost:3000) in isUrl

Test Results

All 60 tests pass across 5 test files. No previously passing tests were broken.

Assumptions

  • truncate truncates at word boundaries with "..." appended, where the total length including ellipsis does not exceed maxLength
  • 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 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 days in formatRelative (fixes 36h → 2 days)
- validator: allow long TLDs in isEmail, allow ports on any hostname 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