Skip to content

Latest commit

 

History

History
59 lines (43 loc) · 3.61 KB

File metadata and controls

59 lines (43 loc) · 3.61 KB

Coverage Report — 2026-06-14

Summary

Metric Before After
Statements 79.86% 89.38%
Branches 69.44% 77.35%
Functions 67.1% 76.92%
Lines 83.33% 92.53%

Total tests: 187 → 233 (+46 new tests).

Week-over-Week (vs 2026-04-12)

Metric 2026-04-12 2026-06-14 Change
Statements 74.9% 89.38% +14.48%
Branches 67.66% 77.35% +9.69%
Functions 62.5% 76.92% +14.42%
Lines 78.05% 92.53% +14.48%
  • Files that were untested last report and are now covered: comments.js (0% → 100%), nudges.js (0% → 100%), cronAuth.js (0% → 100%), email.js (0% → 95.23%)
  • streaks.js improved from 49% → 91.5% statements
  • Files that remain untested across multiple weeks: onboarding.js, partnerships.js, confetti.js, sounds.js

Files Changed (last 7 days)

No lib/ files changed in the last 7 days. Targeted lowest-coverage and untested utility files instead.

New Tests Written

  • tests/unit/lib/streaks.test.js — extended with 14 new tests, now covers: formatUTCDate, formatDateInTimezone, getHourInTimezone, calculateStreak, getActivityHeatmap
  • tests/unit/lib/comments.test.js — 14 tests, covers: getComments, getBatchCommentCounts, postComment, deleteComment
  • tests/unit/lib/nudges.test.js — 5 tests, covers: sendNudge (auth, rate limiting, happy path, insert error, missing profile)
  • tests/unit/lib/cronAuth.test.js — 6 tests, covers: verifyCronSecret (valid token, missing header, missing env, wrong token, wrong length, empty header)
  • tests/unit/lib/email.test.js — 6 tests, covers: sendReminderEmail (happy path, Resend error, network throw, correct recipient, missing userName, XSS escaping)

Mock Helper Update

  • Added limit to tests/setup/supabase-mock.js chain methods, enabling tests for nudges.js (which was previously blocked by the missing .limit() support).

Skipped (out of scope)

  • lib/FocusContext.js, lib/NotificationContext.js, lib/KeyboardShortcutsContext.js — React context providers
  • lib/animations.js — pure animation data presets, no logic to test
  • lib/supabase/* — Supabase client configuration
  • lib/useKeyboardShortcuts.js, lib/useModalScrollLock.js — React hooks (require component rendering)
  • lib/pactTemplates.js, lib/accentColors.js — already at 100% coverage
  • lib/onboarding.js — requires .upsert() mock support (deferred)
  • lib/partnerships.js — requires .or() and multi-chain builder states (deferred)
  • lib/confetti.js, lib/sounds.js — browser-only side-effect modules (canvas/audio APIs)

Notes

  • streaks.js uncovered line 131 is a break inside the current-streak loop when the gap is >1 day; hard to reach since the mock resolves both concurrent queries to the same value (would need per-call builder state). Lines 18-21 are the unexported formatLocalDate helper.
  • activity.js function coverage remains at 29% because fetchProfilesMap (private), isTestActivity (private), and the full happy paths of getGroupActivity/getAllActivity/getGroupStats involve multiple sequential Supabase queries with profile/reaction assembly that the shared mock can't differentiate per-table. The exported functions are tested at their error and empty-data boundaries.
  • cronAuth.js reached 100% coverage by adding a same-length-different-value token test that exercises the timingSafeEqual false branch.
  • Next week's candidates for coverage improvement: onboarding.js and partnerships.js (require mock helper extension for .upsert() and .or()).