Skip to content

fix: make all failing tests pass across utility library#223

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

fix: make all failing tests pass across utility library#223
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2397-1782060165

Conversation

@stooit

@stooit stooit commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all 16 previously failing tests across the 5 utility modules. The full suite now passes: 60 pass / 0 fail. No test files modified, no dependencies added.

Changes

File Fix
src/calculator.ts divide throws Error("Division by zero") instead of returning Infinity
src/string-utils.ts wordCount splits on /\s+/ to handle consecutive whitespace; truncate implemented (returns unchanged within limit, truncates at word boundary, ellipsis counts toward maxLength, handles strings shorter than ellipsis)
src/task-manager.ts Implemented remove (true/false), update (mutates stored task, false for unknown id), and sortBy for priority (high>medium>low), createdAt (oldest first), and status
src/date-utils.ts formatRelative uses Math.round instead of Math.floor — fixes day off-by-one (36h to "2 days ago")
src/validator.ts isEmail accepts long TLDs; isUrl accepts URLs with an explicit port

Verification

  • bun test -> 60 pass, 0 fail, 70 expect() calls
  • Independent review confirmed fixes implement genuine intended behaviour (no hard-coding / over-fitting)

Assumptions

  • Fixes driven strictly by existing test specs; uncovered cases follow conventional/defensive defaults.

- calculator: divide now throws on division by zero
- string-utils: wordCount handles consecutive whitespace; truncate implemented with word-boundary + ellipsis budget
- task-manager: implement remove, update, and sortBy (priority/createdAt/status)
- date-utils: formatRelative uses Math.round to fix day off-by-one
- validator: isEmail accepts long TLDs; isUrl accepts URLs with a port
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