fix: implement missing utilities and fix edge-case bugs to pass all tests - #272
Open
stooit wants to merge 1 commit into
Open
fix: implement missing utilities and fix edge-case bugs to pass all tests#272stooit wants to merge 1 commit into
stooit wants to merge 1 commit into
Conversation
…ests - calculator: divide throws on division by zero - string-utils: implement truncate (word-boundary + ellipsis) and fix wordCount - task-manager: implement remove/update/sortBy methods - date-utils: fix formatRelative off-by-one (round vs floor) - validator: fix isEmail long-TLD and isUrl port handling
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
Makes all 60 tests pass (was 16 failing). Implemented missing functionality and fixed edge-case bugs across five utility modules. No test files modified, no new dependencies.
Changes
src/calculator.tsdividenow throwsError("Division by zero")whenb === 0(also catches-0) instead of returningInfinity/NaN.src/string-utils.tstruncate(word-boundary cut,"..."counted withinmaxLength, unchanged when it already fits) and fixedwordCountto collapse consecutive spaces.src/task-manager.tsremove/update(returnboolean,falsefor unknown id) andsortBy(priority high>medium>low; createdAt oldest-first, stable).src/date-utils.tsformatRelativeoff-by-one (Math.roundinstead ofMath.flooron the day boundary).src/validator.tsisEmailfor long TLDs andisUrlfor URLs with a port (now uses theURLconstructor).Verification
bun test-> 60 pass / 0 failtsc --noEmitcleanAssumptions
Generated with QuantCode Agent