Skip to content

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

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2222-1790958006
Open

stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2222-1790958006

Conversation

@stooit

@stooit stooit commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all 16 failing tests (now 60/60 pass, tsc --noEmit clean). No test files modified, no dependencies added.

  • calculator: divide throws Error("Division by zero") when b === 0.
  • date-utils: formatRelative rounds days (Math.round(Math.abs(diffHours)/24)) instead of flooring, matching the test's assertion at 36h; symmetric for past/future.
  • string-utils: wordCount splits on /\s+/ after trim; truncate implemented (word-boundary cut, ... counts toward maxLength, hard-slice when maxLength <= 3, clamped for negatives).
  • validator: isEmail TLD bound {2,4} → {2,} (minimal change); isUrl no longer rejects URLs with a port.
  • task-manager: implemented remove, update, sortBy (priority high→low, status, createdAt oldest-first; returns a copy).

Assumptions

  • Day rounding behaviour follows the test's actual assertion (the test title wording "1 day ago" differs from its expected value).
  • update allows explicitly clearing description by passing undefined; title/priority ignore undefined.
  • truncate with negative maxLength returns "" (defensive, untested).
  • Review feedback applied: kept isEmail local-part permissive (original [^\s@]+) to avoid rejecting valid addresses like o'brien@….

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