Testing & Sharing¶
Last updated: June 2026 (revised — Firebase integration steps removed, MongoDB/VPS testing notes updated)
Testing Strategy¶
- Type checking: Run
npm run lint(tsc --noEmit) before every commit. Zero errors required. - Scoring logic:
calculateResult()inscoring.tsis pure — test against known answer patterns manually or via unit tests. Do not modify without regression checks. - Integration testing: Exercise VPS API endpoints (
/api/auth,/api/users,/api/responses) using curl or the test suite inserver/tests/api.test.js. Use the seed script (server/tests/seed.js) to populate test data. - UI/UX testing: Responsive checks on mobile, tablet, and desktop.
- 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:
- Complete the assessment with a test account.
- Connect to MongoDB:
ssh root@76.13.211.100thenmongosh personality_db. - Find the responses doc:
db.responses.findOne({ _id: '<uid>' }). ThecreatedAtfield will be a recent timestamp. - To test the locked state: leave
createdAtas-is and access/questionnaire— you will see the locked screen. - To test the unlocked state: set
createdAtto a date more than 6 months ago:
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)¶
- Ensure all
STRIPE_*env vars are set in/opt/personality-app/.envand PM2 is restarted with--update-env. - Use a Stripe test card (
4242 4242 4242 4242) on the Pricing page. - After payment success, connect to MongoDB (
mongosh personality_db) and verifydb.users.findOne({ _id: '<uid>' })hasplan: 'explorer'and a validplanExpiresAt. - Access
/life-design— should be unlocked. - Test a promo code: create one in AdminDashboard → Promo Codes, then enter it on
/pricing. free_accesstype: should skip Stripe and set plan directly.percent_off/fixed_offtype: should show discounted price and proceed through Stripe with an applied coupon.
Testing the Coach Payment Gate¶
- Submit a test application via
/coach-apply. - In AdminDashboard → Coaches → Applications, click Pre-Approve on the application.
- Log in as the test coach user — verify "Coach Portal" nav link appears.
- Navigate to
/coach-portal— should see the Payment Gate screen (RM 599 + promo option). - Click pay with test card
4242 4242 4242 4242. - After redirect to
/payment/success, return to/coach-portal— should show the "Payment Confirmed!" teal screen. - In MongoDB, verify
db.users.findOne({ _id: '<uid>' })hascoachAppStatus === 'payment_received'and thecoachApplicationsdoc showsstatus: 'payment_received'. - In AdminDashboard → Coaches → Applications, verify the "Activate Coach" button is now visible.
- Click Activate Coach — full portal should unlock. Verify in MongoDB:
db.users.findOne({ _id: '<uid>' })hasplan === 'coach'and nocoachAppStatusfield. - 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.createdAtin 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¶
- Complete the assessment and view the report as an Explorer-plan user.
- Scroll to the bottom — the feedback widget appears above the footer.
- Select a rating and optionally add a note. Click Submit.
- Verify in MongoDB:
db.reportFeedback.findOne({ _id: '<uid>' })should exist with the correct rating and note. - Reload the report — the widget should pre-select the saved rating.
- In AdminDashboard → Feedback tab: the entry should appear with correct rating badge and timestamp.
- Confirm the widget is not visible when printing (has
print:hiddenclass). - Confirm the widget is not visible in admin view mode (
isAdminView = true).
Testing Messaging & Notifications¶
- Log in as a coach and an approved client (who has an active coaching relationship).
- Navigate to
/messagesas the client — the first conversation should auto-select. - Send a message and verify it appears for the other party within ~3 seconds (polling interval).
- Verify notification links for coaching events (e.g. payment confirmed) navigate to
/messages?conv=<uuid>and open the correct thread. - Test "Mark all read": click bell icon → mark all read — badge should clear.
- 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
/adminto 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
strengthandgrowthfields inframework.jsonare 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 --noEmitexits with code 0 - [ ] No psychology jargon or corporate speak in user-facing strings
- [ ] Teen-readable language (age 15+) throughout