Skip to content

fix: make all tests pass (calculator, string-utils, task-manager, date-utils, validator)#227

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2445-1782492610
Open

fix: make all tests pass (calculator, string-utils, task-manager, date-utils, validator)#227
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2445-1782492610

Conversation

@stooit

@stooit stooit commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all 16 previously-failing tests across the utility library. The full suite now passes: 60 passing / 0 failing. No test files were modified and no dependencies were added.

Changes

  • src/calculator.tsdivide now throws Error("Division by zero") when the divisor is 0.
  • src/string-utils.tswordCount now trims and splits on \s+ so runs of whitespace don't create empty tokens; truncate implemented to append whole words up to the limit.
  • src/task-manager.ts — completed missing/incomplete TaskManager methods to match expected behaviour.
  • src/date-utils.ts — fixed an off-by-one in relative-time formatting (use Math.floor rather than Math.round).
  • src/validator.tsisUrl now accepts URLs with an explicit port (e.g. http://localhost:3000).

Verification

bun test → 60 pass, 0 fail, 70 expect() calls across 5 files.

Assumptions

  • Behaviour was reverse-engineered from the existing tests, which were treated as the source of truth and left unmodified.
  • Division-by-zero error message text matches what the calculator test asserts.

🤖 Generated autonomously.

…ests

- calculator: throw on division by zero
- string-utils: fix wordCount whitespace handling, implement truncate
- task-manager: complete missing/incomplete methods
- date-utils: fix off-by-one in relative time (floor vs round)
- validator: accept URLs with port in isUrl

All 60 tests pass.
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