fix: repair all failing utility-library tests#221
Open
stooit wants to merge 1 commit into
Open
Conversation
…sk, and validator modules
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 previously-failing tests across the utility library. The full suite now passes (60 pass / 0 fail).
Changes
src/calculator.ts—dividenow throwsError("Division by zero")on a zero divisor (b === 0) instead of returningInfinity.src/validator.ts—isEmailTLD pattern widened from{2,4}to{2,}(accepts long TLDs);isUrlreimplemented with theURLconstructor + protocol check so ports, query strings and fragments validate correctly.src/string-utils.ts—wordCountsplits on/\s+/after trimming (collapses consecutive spaces);truncatecuts at a word boundary with the"..."ellipsis counting towardmaxLength.src/task-manager.ts—remove/updatereturnfalsefor unknown IDs;sortByorders bypriority(high → medium → low) and bycreatedAt(oldest first).src/date-utils.ts—formatRelativeoff-by-one fixed (36h now reports"2 days ago").Verification
bun test→ 60 pass, 0 fail.formatRelativerounding near the ~23h30m boundary;truncatereturning input unchanged whenmaxLength <= 3) — both pre-existing, untested, out of scope.Assumptions
src/changed, per task constraints.