Skip to content

fix(#255): deduplicate check-in deadline into shared helper - #309

Merged
icentedward76-sketch merged 1 commit into
SoroWill:mainfrom
wendyamoni-creator:fix/255-deduplicate-deadline-calculation
Aug 31, 2026
Merged

fix(#255): deduplicate check-in deadline into shared helper#309
icentedward76-sketch merged 1 commit into
SoroWill:mainfrom
wendyamoni-creator:fix/255-deduplicate-deadline-calculation

Conversation

@wendyamoni-creator

@wendyamoni-creator wendyamoni-creator commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #255.

The check-in deadline formula (lastCheckin + checkinPeriodDays × 86 400 × 1000) existed in three places:

File Status
src/lib/deadlines.ts ✅ canonical — untouched
src/lib/certificate.ts ✅ already imported nextCheckinDeadline — no change needed
src/lib/reminders.ts ❌ private buildDeadline()removed

Changes

src/lib/reminders.ts

  • Added import { nextCheckinDeadline } from '@/lib/deadlines'
  • Deleted the private buildDeadline function
  • Replaced its one call site with nextCheckinDeadline(will)

tests/unit/certificate.test.ts (new)

  • Asserts the Next check-in due: PDF line matches nextCheckinDeadline's output for the same Will fixture
  • Confirms the line is omitted for non-Active wills
  • Independently verifies the formula for a fixed lastCheckin/checkinPeriodDays matches the shared helper

Verification

✓ tests/unit/certificate.test.ts (3 tests)
✓ tests/unit/reminders.test.ts (5 tests)

No errors from tsc --noEmit in any modified file. The package-lock.json is intentionally excluded from this commit (it changed only because node_modules was missing in the dev container). closes #255

Remove the private buildDeadline() in reminders.ts — a third verbatim
copy of the lastCheckin + checkinPeriodDays * 86_400_000 formula that
was already centralized in lib/deadlines.ts. Replace its one call site
with nextCheckinDeadline(will) from the shared module.

certificate.ts was already importing nextCheckinDeadline correctly, so
no change was needed there.

Add tests/unit/certificate.test.ts to assert downloadWillCertificate's
'Next check-in due' PDF line matches nextCheckinDeadline's output for
the same Will fixture, satisfying the acceptance criterion from SoroWill#255.
@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

@wendyamoni-creator Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@vercel

vercel Bot commented Aug 31, 2026

Copy link
Copy Markdown

@wendyamoni-creator is attempting to deploy a commit to the icentedward76-sketch's projects Team on Vercel.

A member of the Team first needs to authorize it.

@icentedward76-sketch
icentedward76-sketch merged commit 28b7093 into SoroWill:main Aug 31, 2026
0 of 3 checks passed
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.

certificate.ts has a third private copy of the check-in-deadline calculation, already duplicated elsewhere

2 participants