Skip to content

fix: resolve all 16 failing tests in utility library#168

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/job-e2e-tier1-2390-1779437303
Open

fix: resolve all 16 failing tests in utility library#168
stooit wants to merge 1 commit into
mainfrom
quantcode/job-e2e-tier1-2390-1779437303

Conversation

@stooit
Copy link
Copy Markdown
Contributor

@stooit stooit commented May 22, 2026

Summary

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

Changes

File Fix
src/calculator.ts Throw Error("Division by zero") when divisor is 0
src/string-utils.ts Fix wordCount to split on /\s+/ and filter empties; implement truncate with word-boundary logic
src/date-utils.ts Use Math.round instead of Math.floor for days in formatRelative
src/task-manager.ts Implement remove, update, and sortBy methods
src/validator.ts Allow TLDs of 2+ chars in isEmail; allow port numbers in isUrl

Assumptions

  • sortBy("priority") orders high > medium > low (descending importance)
  • sortBy("createdAt") orders oldest first (ascending)
  • truncate prefers word boundaries but falls back to hard truncation when necessary

…utils, task-manager, and validator

- calculator: throw Error on division by zero instead of returning Infinity
- string-utils: fix wordCount to handle multiple spaces, implement truncate
- date-utils: use Math.round for days in formatRelative (36h = 2 days)
- task-manager: implement remove, update, and sortBy methods
- validator: allow long TLDs 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