Skip to content

fix: repair all failing utility-library tests#225

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2492-1782320038
Open

fix: repair all failing utility-library tests#225
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2492-1782320038

Conversation

@stooit

@stooit stooit commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all 16 previously failing tests across the utility library. The suite now reports 60 pass, 0 fail with no previously-passing test broken.

Changes by file

  • src/calculator.tsdivide() now throws Error("Division by zero") when the divisor is 0 (was returning Infinity).
  • src/string-utils.ts — implemented truncate(); fixed wordCount() to split on /\s+/ so consecutive whitespace no longer inflates the count.
  • src/task-manager.ts — implemented the missing/incomplete remove, update, and sortBy methods.
  • src/date-utils.ts — fixed the off-by-one in formatRelative by rounding day boundaries (Math.round), so e.g. 36 hours → "2 days ago".
  • src/validator.tsisEmail now accepts long TLDs (e.g. .museum); isUrl now accepts URLs with ports (e.g. http://localhost:3000).
  • Removed stale BUG: JSDoc comments that described already-fixed behaviour.

Verification

  • bun test → 60 pass, 0 fail (70 expect() calls).
  • No test files modified, no dependencies added.
  • A review pass confirmed the fixes address root causes; the date-utils rounding behaviour matches the documented contract (36h → "2 days ago").

Assumptions

  • Test files are the source of truth for expected behaviour; fixes were made to satisfy them exactly without overfitting logic.

…validator utils

- calculator: divide() now throws on division by zero
- string-utils: implement truncate() and fix wordCount() whitespace handling
- task-manager: implement missing remove/update/sortBy methods
- date-utils: fix formatRelative off-by-one (Math.round day boundaries)
- validator: isEmail accepts long TLDs; isUrl accepts URLs with ports
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