Skip to content

fix: resolve failing tests and implement missing utilities - #458

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-930-1794284630
Open

stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-930-1794284630

Conversation

@stooit

@stooit stooit commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Makes all 60 tests pass (previously 44 pass / 16 fail). tsc --noEmit is clean. No test files were changed and no dependencies were added.

  • calculator: divide throws Error("Division by zero") when b === 0.
  • date-utils: formatRelative rounds days with Math.round(Math.abs(hours)/24), so 36h gives "2 days ago". Past and future dates now round the same way.
  • validator: isEmail accepts TLDs of 2 or more characters (it used to cap them at 4). isUrl no longer rejects URLs with a port.
  • string-utils: wordCount splits on runs of whitespace. truncate is implemented: it cuts at a word boundary and the ellipsis counts toward maxLength.
  • task-manager: implemented remove, update and sortBy (priority, createdAt, status).
  • Removed out-of-date BUG/TODO comments.

Assumptions

  • sortBy('status') puts pending first, then in_progress, then completed. No test covers this order.
  • truncate with maxLength <= 3 returns the ellipsis cut down to maxLength. A single word longer than the limit is cut mid-word.
  • update ignores fields left undefined, so update can't clear a description.

Known limitations (not changed, out of scope)

  • isUrl only checks the protocol, so URLs containing credentials still pass. Don't use it as a security control.
  • isEmail accepts some malformed addresses (e.g. a@b..com).
  • Times between 23.5h and 24h show as "24 hours ago".

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