Skip to content

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

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/job-e2e-tier1-2350-1779468881
Open

fix: resolve all 16 failing tests across utility library#177
stooit wants to merge 1 commit into
mainfrom
quantcode/job-e2e-tier1-2350-1779468881

Conversation

@stooit
Copy link
Copy Markdown
Contributor

@stooit stooit commented May 22, 2026

Summary

  • calculator.ts: Throw Error on divide-by-zero instead of returning Infinity
  • string-utils.ts: Fix wordCount to handle multiple consecutive spaces; implement truncate with word-boundary logic
  • date-utils.ts: Use Math.round instead of Math.floor for relative day calculation (36h → "2 days ago")
  • validator.ts: Allow TLDs of 2+ characters in isEmail; support port numbers in isUrl
  • task-manager.ts: Implement missing remove, update, and sortBy methods

Test Results

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

Assumptions

  • formatRelative uses Math.round for day boundaries (matches test expectations)
  • truncate truncates at word boundary when possible, hard-truncates at maxLength - 3 otherwise
  • sortBy("priority") orders high > medium > low
  • No test files were modified
  • No new dependencies added

- calculator: throw Error on divide by zero instead of returning Infinity
- string-utils: fix wordCount to handle multiple spaces, implement truncate
- date-utils: use Math.round instead of Math.floor for relative day calc
- validator: allow TLDs 2+ chars in isEmail, support ports in isUrl
- task-manager: implement remove, update, and sortBy methods
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