Skip to content

fix: repair 16 failing tests across utility library#240

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2456-1783357667
Open

fix: repair 16 failing tests across utility library#240
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2456-1783357667

Conversation

@stooit

@stooit stooit commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all 16 failing tests in the TypeScript utility library. 60/60 tests now pass with no regressions. Only source files were changed — no test files touched, no dependencies added.

Changes

File Fix
src/calculator.ts divide throws Error("Division by zero") when divisor is 0
src/string-utils.ts wordCount splits on /\s+/ (handles consecutive spaces); implemented truncate (unchanged if within limit, word-boundary truncation, ellipsis counts toward maxLength, handles strings shorter than the ellipsis)
src/task-manager.ts Implemented remove (returns bool), update (title/priority, returns bool), and sortBy (priority high→medium→low, createdAt oldest first)
src/date-utils.ts Fixed off-by-one in formatRelative day rounding
src/validator.ts isEmail accepts long TLDs (e.g. .museum); isUrl accepts URLs with a port

Also removed three stale BUG: JSDoc comments that described now-fixed behaviour.

Verification

  • bun test → 60 pass, 0 fail
  • Independent review pass confirmed fixes are genuine (not test-string gaming).

Assumptions

  • Test files are the source of truth for expected behaviour.

- calculator: divide now throws on division by zero
- string-utils: wordCount splits on whitespace runs; implement truncate
- task-manager: implement remove, update, and sortBy
- date-utils: fix off-by-one in formatRelative day rounding
- validator: allow long TLDs in isEmail and 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