Skip to content

Testing & Sharing

Last updated: June 2026 (revised — Firebase integration steps removed, MongoDB/VPS testing notes updated)


Testing Strategy

  1. Type checking: Run npm run lint (tsc --noEmit) before every commit. Zero errors required.
  2. Scoring logic: calculateResult() in scoring.ts is pure — test against known answer patterns manually or via unit tests. Do not modify without regression checks.
  3. Integration testing: Exercise VPS API endpoints (/api/auth, /api/users, /api/responses) using curl or the test suite in server/tests/api.test.js. Use the seed script (server/tests/seed.js) to populate test data.
  4. UI/UX testing: Responsive checks on mobile, tablet, and desktop.
  5. PDF export: Test the Download button on deployed URL — requires correct CORS for web fonts.

Testing the 6-Month Retake Cooldown

To test the locked screen without waiting 6 months:

  1. Complete the assessment with a test account.
  2. Connect to MongoDB: ssh root@76.13.211.100 then mongosh personality_db.
  3. Find the responses doc: db.responses.findOne({ _id: '<uid>' }). The createdAt field will be a recent timestamp.
  4. To test the locked state: leave createdAt as-is and access /questionnaire — you will see the locked screen.
  5. To test the unlocked state: set createdAt to a date more than 6 months ago:
db.responses.updateOne({ _id: '<uid>' }, { $set: { createdAt: new Date('2025-01-01') } })

Admin override (production use): If a real user needs an early retake (e.g. major life event), use the AdminDashboard Users tab cooldown-reset button, or connect via mongosh and manually set createdAt to any date 6+ months ago. The cooldown will lift immediately on their next page load.


Testing Payments (Stripe)

  1. Ensure all STRIPE_* env vars are set in /opt/personality-app/.env and PM2 is restarted with --update-env.
  2. Use a Stripe test card (4242 4242 4242 4242) on the Pricing page.
  3. After payment success, connect to MongoDB (mongosh personality_db) and verify db.users.findOne({ _id: '<uid>' }) has plan: 'explorer' and a valid planExpiresAt.
  4. Access /life-design — should be unlocked.
  5. Test a promo code: create one in AdminDashboard → Promo Codes, then enter it on /pricing.
  6. free_access type: should skip Stripe and set plan directly.
  7. percent_off / fixed_off type: should show discounted price and proceed through Stripe with an applied coupon.

Testing the Coach Payment Gate

  1. Submit a test application via /coach-apply.
  2. In AdminDashboard → Coaches → Applications, click Pre-Approve on the application.
  3. Log in as the test coach user — verify "Coach Portal" nav link appears.
  4. Navigate to /coach-portal — should see the Payment Gate screen (RM 599 + promo option).
  5. Click pay with test card 4242 4242 4242 4242.
  6. After redirect to /payment/success, return to /coach-portal — should show the "Payment Confirmed!" teal screen.
  7. In MongoDB, verify db.users.findOne({ _id: '<uid>' }) has coachAppStatus === 'payment_received' and the coachApplications doc shows status: 'payment_received'.
  8. In AdminDashboard → Coaches → Applications, verify the "Activate Coach" button is now visible.
  9. Click Activate Coach — full portal should unlock. Verify in MongoDB: db.users.findOne({ _id: '<uid>' }) has plan === 'coach' and no coachAppStatus field.
  10. Verify the session appears in the Stripe Dashboard under Subscriptions with the correct schedule (RM 599 → RM 199).

Testing the renewal banner:

  • Temporarily set coach.createdAt in MongoDB to a date ~29 days ago — amber banner should appear.
  • Set to a date in the past year-minus-one-day — red banner should appear.

Testing Post-Report Feedback

  1. Complete the assessment and view the report as an Explorer-plan user.
  2. Scroll to the bottom — the feedback widget appears above the footer.
  3. Select a rating and optionally add a note. Click Submit.
  4. Verify in MongoDB: db.reportFeedback.findOne({ _id: '<uid>' }) should exist with the correct rating and note.
  5. Reload the report — the widget should pre-select the saved rating.
  6. In AdminDashboard → Feedback tab: the entry should appear with correct rating badge and timestamp.
  7. Confirm the widget is not visible when printing (has print:hidden class).
  8. Confirm the widget is not visible in admin view mode (isAdminView = true).

Testing Messaging & Notifications

  1. Log in as a coach and an approved client (who has an active coaching relationship).
  2. Navigate to /messages as the client — the first conversation should auto-select.
  3. Send a message and verify it appears for the other party within ~3 seconds (polling interval).
  4. Verify notification links for coaching events (e.g. payment confirmed) navigate to /messages?conv=<uuid> and open the correct thread.
  5. Test "Mark all read": click bell icon → mark all read — badge should clear.
  6. Test "Clear all": click bell icon → clear all — all notifications removed, panel closes.

Sharing the App

  • AI Studio Preview: Share the generated URL for immediate stakeholder or user feedback.
  • Test accounts: Create separate test accounts for each archetype type to verify the report renders correctly end-to-end.
  • Admin Console: Use /admin to verify data is captured correctly across multiple accounts.
  • PDF export testing: Export a PDF from the Report page and verify all 13+ sections render with correct multi-column layouts.

Content Review Checklist

Before publishing or sharing, verify:

  • [ ] All strength and growth fields in framework.json are complete standalone sentences (not fragments)
  • [ ] No template wrapper strings in SectionCard — content renders directly
  • [ ] All markdown docs pass linting (MD022, MD031, MD032, MD040, MD060)
  • [ ] tsc --noEmit exits with code 0
  • [ ] No psychology jargon or corporate speak in user-facing strings
  • [ ] Teen-readable language (age 15+) throughout