Skip to content

fix: repair all failing utility-library tests#226

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2416-1782406547
Open

fix: repair all failing utility-library tests#226
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2416-1782406547

Conversation

@stooit

@stooit stooit commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all 16 failing tests across the TypeScript utility library so the full suite passes (60/60), without modifying any tests or adding dependencies.

Changes

  • src/calculator.tsdivide now throws Error("Division by zero") when the divisor is 0 instead of returning Infinity.
  • src/date-utils.tsformatRelative uses Math.round instead of Math.floor for the hours→days conversion, fixing the off-by-one (e.g. 36h → "2 days ago").
  • src/string-utils.ts — implemented the missing utility function(s) required by the tests.
  • src/task-manager.ts — completed the missing/incomplete TaskManager methods.
  • src/validator.ts — broadened validation to handle edge cases the tests cover (e.g. isUrl with a port).

Verification

bun test60 pass, 0 fail.

Assumptions & scope notes

  • Changes kept minimal and strictly driven by what the tests assert. No test files modified, no dependencies added.
  • A review pass flagged a few latent, untested edge cases left out of scope (e.g. truncate with maxLength ≤ 3, sortBy tiebreaking on equal timestamps, empty titles in TaskManager). None affect the suite — noted for future follow-up.

…sk-manager, validator

- calculator: throw on division by zero instead of returning Infinity
- date-utils: round (not floor) hours-to-days in formatRelative
- string-utils: implement missing utility functions
- task-manager: complete missing/incomplete TaskManager methods
- validator: handle edge cases (e.g. URLs with ports) in validation
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