Skip to content

fix: resolve all 16 failing tests across utility modules#181

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/job-e2e-tier1-2397-1779815757
Open

fix: resolve all 16 failing tests across utility modules#181
stooit wants to merge 1 commit into
mainfrom
quantcode/job-e2e-tier1-2397-1779815757

Conversation

@stooit
Copy link
Copy Markdown
Contributor

@stooit stooit commented May 26, 2026

Summary

  • Fixed 16 failing tests across 5 source files without modifying any test files
  • All 60 tests now pass

Changes

File Fix
src/calculator.ts Added division-by-zero guard that throws an error instead of returning Infinity
src/string-utils.ts Fixed wordCount to handle consecutive spaces; implemented truncate with word-boundary logic
src/task-manager.ts Implemented remove, update, and sortBy methods
src/date-utils.ts Changed day calculation in formatRelative from Math.floor to Math.round
src/validator.ts Extended email regex to allow longer TLDs; extended URL regex to support port numbers

Assumptions

  • truncate finds the last space within maxLength - 3 chars for word-boundary truncation, falling back to hard cut if no space fits
  • sortBy("priority") orders high > medium > low
  • sortBy("createdAt") orders oldest first
  • sortBy("status") uses default string comparison

…anager, date-utils, and validator

- 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 for day calculation in formatRelative
- validator: allow longer TLDs in isEmail, support 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