fix: repair all failing utility-library tests#226
Open
stooit wants to merge 1 commit into
Open
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.ts—dividenow throwsError("Division by zero")when the divisor is0instead of returningInfinity.src/date-utils.ts—formatRelativeusesMath.roundinstead ofMath.floorfor 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/incompleteTaskManagermethods.src/validator.ts— broadened validation to handle edge cases the tests cover (e.g.isUrlwith a port).Verification
bun test→ 60 pass, 0 fail.Assumptions & scope notes
truncatewithmaxLength ≤ 3,sortBytiebreaking on equal timestamps, empty titles inTaskManager). None affect the suite — noted for future follow-up.