Skip to content

fix: resolve all failing tests across utility library#182

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/job-e2e-tier1-2368-1779835766
Open

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

Conversation

@stooit
Copy link
Copy Markdown
Contributor

@stooit stooit commented May 26, 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 truncation
  • date-utils.ts: Use Math.round for day calculation in formatRelative (fixes off-by-one at 36 hours)
  • task-manager.ts: Implement remove, update, and sortBy methods
  • validator.ts: Fix email regex to accept TLDs longer than 4 chars; fix URL regex to accept ports

Testing

All 60 tests pass (bun test). No test files were modified.

Assumptions

  • truncate truncates at word boundaries when possible, falling back to hard truncation
  • sortBy("priority") orders high > medium > low
  • sortBy("createdAt") orders oldest first
  • formatRelative uses Math.round for days (36h = 2 days ago)

- calculator: throw on division by zero instead of returning Infinity
- string-utils: fix wordCount for multiple spaces, implement truncate
- date-utils: use Math.round for day calculation in formatRelative
- task-manager: implement remove, update, and sortBy methods
- validator: fix email TLD length and URL port support in regexes
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