Skip to content

fix: resolve all 16 failing tests across utility library#192

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2677-1780422165
Open

fix: resolve all 16 failing tests across utility library#192
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2677-1780422165

Conversation

@stooit
Copy link
Copy Markdown
Contributor

@stooit stooit commented Jun 2, 2026

Summary

  • calculator.ts: Throw Error("Division by zero") when divisor is 0 (was returning Infinity)
  • string-utils.ts: Fix wordCount to handle consecutive spaces; implement truncate with word-boundary logic
  • task-manager.ts: Implement remove, update, and sortBy methods
  • date-utils.ts: Use Math.round instead of Math.floor for day calculation in formatRelative
  • validator.ts: Allow TLDs longer than 4 chars in isEmail; allow port numbers in isUrl

Test Results

All 60 tests pass (previously 44 pass / 16 fail).

Assumptions

  • truncate cuts at the last space before maxLength - 3 and appends "..." to stay within maxLength
  • sortBy("priority") orders high > medium > low
  • sortBy("createdAt") orders oldest first
  • No test files were modified; no new dependencies added

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