fix: implement missing utilities and fix failing-test edge cases#256
Open
stooit wants to merge 1 commit into
Open
fix: implement missing utilities and fix failing-test edge cases#256stooit wants to merge 1 commit into
stooit wants to merge 1 commit into
Conversation
- calculator: throw on division by zero - date-utils: fix formatRelative off-by-one (Math.round for days) - string-utils: implement truncate at word boundary; fix isPalindrome case-insensitivity - task-manager: implement missing update method - validator: fix isEmail/isUrl edge cases; harden isUrl against whitespace and bare hosts
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 (previously 16 failing across 5 files). No test files were modified and no dependencies were added.
Changes
divide()now throwsError("Division by zero")when the divisor is 0.formatRelativeoff-by-one: usesMath.roundso e.g. 36 hours ago reads as "2 days ago".truncate()(word-boundary truncation with"..."counted towardmaxLength; returns unchanged whenstr.length <= maxLength); fixed related utility edge cases.isEmail/isUrledge cases; hardenedisUrlto reject whitespace and bare single-char hosts.Verification
bun test→ 60 pass, 0 fail (70 assertions).isUrltightening was applied per that review while keeping all tests green.Assumptions
src/was changed.isUrlhardening goes slightly beyond the minimal fix but improves robustness without breaking any test.