Skip to content

fix: repair failing tests across utility library#232

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2438-1782752973
Open

fix: repair failing tests across utility library#232
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2438-1782752973

Conversation

@stooit

@stooit stooit commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all 16 failing tests across the library. All 60 tests now pass (0 fail). No test files modified, no dependencies added.

Changes

  • src/calculator.tsdivide now throws Error("Division by zero") when the divisor is 0 (previously returned Infinity).
  • src/date-utils.tsformatRelative uses Math.round instead of Math.floor for the hours→days conversion, fixing the off-by-one (36h now → "2 days ago").
  • src/string-utils.ts — implemented wordCount collapsing of multiple consecutive spaces, and the truncate word-boundary logic (ellipsis counts toward maxLength).
  • src/task-manager.ts — implemented the missing/incomplete remove, update, and sortBy (priority and createdAt) methods.
  • src/validator.tsisEmail now accepts long TLDs (e.g. user@example.museum); isUrl now accepts URLs with a port (e.g. http://localhost:3000).

Verification

  • bun test → 60 pass / 0 fail.
  • Independent review pass confirmed fixes are correct, idiomatic, and introduce no regressions.

Assumptions

  • Followed "fix only what the tests require": pre-existing edge cases outside the tested range (e.g. truncate with maxLength <= ellipsis.length) were left untouched to avoid altering the established contract.
- calculator: divide throws on division by zero
- date-utils: formatRelative rounds hours-to-days (fixes off-by-one)
- string-utils: implement wordCount multi-space handling and truncate
- task-manager: implement remove/update/sortBy methods
- validator: fix isEmail long-TLD and isUrl port handling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant