Skip to content

fix: resolve failing tests across utility modules - #353

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2191-1790353250
Open

stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2191-1790353250

Conversation

@stooit

@stooit stooit commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all 16 failing tests (bun test: 44/16 → 60/0; tsc --noEmit clean). No test files or dependencies changed.

  • calculator: divide throws Error("Division by zero") when b === 0.
  • date-utils: formatRelative uses Math.round for day count (36h → "2 days ago"); removed the stale BUG comment.
  • string-utils: wordCount splits on /\s+/; implemented truncate (word-boundary cut, ... counts toward maxLength).
  • task-manager: implemented remove, update (only applies provided fields, false for unknown id), sortBy (priority high→low, status, createdAt oldest first; non-mutating).
  • validator: isEmail accepts TLDs longer than 4 chars; isUrl no longer rejects URLs with ports (http/https allowlist kept).

Assumptions / notes

  • sortBy("status") order assumed pending → in_progress → completed (untested; needed for type exhaustiveness).
  • truncate with maxLength <= 3 hard-cuts without ellipsis (untested edge case; left as-is).
  • sortBy("createdAt") ties within the same millisecond rely on stable sort/insertion order.

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