Skip to content

test: cover password-reset, invite helpers, property access, ledger months - #74

Closed
cursor[bot] wants to merge 5 commits into
mainfrom
cursor/missing-test-coverage-c212
Closed

cursor[bot] wants to merge 5 commits into
mainfrom
cursor/missing-test-coverage-c212

Conversation

@cursor

@cursor cursor Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Risky behavior now covered

  1. Password-reset links — raw token length, SHA-256 hashing, portal URL encoding, and DB-row validity (inactive / used / expired vs usable) so completePasswordReset stays fail-closed.
  2. Native lease invites — email normalize/required fields, invite reset URL next=/tenant/lease, and shared token hashing with forgot-password (so invite tokens redeem on the same path).
  3. Property / maintenance RBAC — owner/super_admin org properties vs manager assignments; tenants only see their own maintenance requests; empty assignments deny access.
  4. Payment ledger month/archivebillingMonthKey fallbacks; archived former-tenant successes must not supersede live failed rows (Davontaye / site-archive policy).

Test files added/updated

  • scripts/test-password-reset-token.js (+ exports in password-reset.service.js)
  • scripts/test-tenant-invite-helpers.js (+ exports in tenant-invite.service.js)
  • scripts/test-property-access.js
  • scripts/test-payment-ledger-month.js
  • package.json scripts: test:password-reset-token, test:tenant-invite-helpers, test:property-access, test:payment-ledger-month

Why these tests materially reduce regression risk

These paths are high blast-radius (auth recovery, lease onboarding invites, staff/tenant data scoping, former-tenant ledger hiding) and were unclaimed by open coverage drafts #66#73. Suites are deterministic Node asserts with a mocked DB for access checks—no Stripe/DB flakiness.

Validation

npm run test:password-reset-token
npm run test:tenant-invite-helpers
npm run test:property-access
npm run test:payment-ledger-month

All passed locally.

Note

Tiny testability extracts only (export pure helpers / use them in existing control flow). No production behavior change beyond equivalent validity checks.

Open in Web View Automation 

cursoragent and others added 5 commits August 24, 2026 10:10
Export pure helpers used by completePasswordReset so short/used/expired
links stay fail-closed without needing a live DB.

Co-authored-by: Jose I. Montero <2eezy77@users.noreply.github.com>
Assert invite reset URLs keep the lease next path and hash tokens the
same way as forgot-password.

Co-authored-by: Jose I. Montero <2eezy77@users.noreply.github.com>
Mocked pool checks owner/org vs assignment scoping and tenant-only
maintenance visibility.

Co-authored-by: Jose I. Montero <2eezy77@users.noreply.github.com>
Archived former-tenant successes must not supersede live failed rows;
month keys follow period_start → due_date → paid_at.

Co-authored-by: Jose I. Montero <2eezy77@users.noreply.github.com>
Add test:password-reset-token, test:tenant-invite-helpers,
test:property-access, and test:payment-ledger-month.

Co-authored-by: Jose I. Montero <2eezy77@users.noreply.github.com>
@2eezy77 2eezy77 closed this Sep 1, 2026
@cursor
cursor Bot deleted the cursor/missing-test-coverage-c212 branch September 1, 2026 21:14
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.

2 participants