LifeMate — Personal, Family & Learning Companion
fix/personal-notification-controls
chore/phase1-repository-cleanup
deploy/stable-web-apk
deployment-static
design/mobile-accessibility-v2
design/mobile-navigation-review
docs/child-education-access-decision
docs/offline-data-rescue-options
docs/owner-guide-and-delivery-plan
docs/phase1-policy-options
docs/public-review-live-2026-10-15
feat/aparat-learning-library
feat/child-device-safety
feat/child-identity-schema
feat/flutter-mobile-navigation
feat/learning-content-operations
feat/local-signing-preflight
feat/online-family-stage0
feat/personal-encrypted-recovery
feat/private-planner-series-api
feat/public-review-page
feat/standalone-weekly-planner
feat/weekly-planner-android
final-feature-1/iran-family-school
fix/auth-abuse-expiry-safety
fix/auth-expiry-after-lock
fix/backend-request-safety
fix/lifeguide-bootstrap-naming-ci
fix/lifeguide-pages-qa-base-preflight
fix/lifeguide-qa-pages-env-deployment
fix/local-task-persistence
fix/managed-child-session-boundary
fix/personal-jalali-dates
fix/personal-notification-controls
fix/personal-upgrade-delivery-guard
fix/sms-approval-gates
fix/study-duration-display
infra/cloudflare-neon-migration
infra/lifeguide-cloudflare-qa
infra/lifeguide-github-pages-qa
infra/lifeguide-supabase-qa
main
phase-1/foundation-completion
phase-2/product-foundation-identity
phase-3/planner-school-family-core
phase-4/ai-learning-wellbeing
phase-5/hardening-observability-release
test/android-reminder-acceptance
test/personal-notification-settings
test/personal-recovery-acceptance
test/role-entry-apk
| 1 | import test from 'node:test'; |
| 2 | import assert from 'node:assert/strict'; |
| 3 | import { createSmsProvider } from '../src/auth_delivery.js'; |
| 4 | |
| 5 | const config = { NODE_ENV: 'production', SMS_PROVIDER: 'kavenegar', |
| 6 | KAVENEGAR_API_KEY: 'SyntheticApprovalFixtureNotALiveKey2026', KAVENEGAR_TEMPLATE: 'lifeguideotp' }; |
| 7 | test('configured credentials cannot enable real SMS before both explicit live and template approval flags', () => { |
| 8 | for (const flags of [{}, { SMS_LIVE_ENABLED: 'true' }, { KAVENEGAR_TEMPLATE_APPROVED: 'true' }, |
| 9 | { SMS_LIVE_ENABLED: 'true', KAVENEGAR_TEMPLATE_APPROVED: 'TRUE' }]) { |
| 10 | let calls = 0; |
| 11 | const provider = createSmsProvider({ env: { ...config, ...flags }, fetchImpl: async () => { calls++; assert.fail('No network allowed'); } }); |
| 12 | assert.equal(provider.configured, false); |
| 13 | assert.equal(provider.status, 'APPROVAL_REQUIRED'); |
| 14 | assert.equal(calls, 0); |
| 15 | } |
| 16 | }); |
| 17 | test('nonproduction network providers also remain gated; development uses injected test-only adapters', () => { |
| 18 | assert.equal(createSmsProvider({ env: { ...config, NODE_ENV: 'development' } }).configured, false); |
| 19 | }); |
| 20 | test('the two explicit flags permit adapter construction but never send a message by themselves', () => { |
| 21 | let calls = 0; |
| 22 | const provider = createSmsProvider({ env: { ...config, SMS_LIVE_ENABLED: 'true', KAVENEGAR_TEMPLATE_APPROVED: 'true' }, fetchImpl: async () => { calls++; } }); |
| 23 | assert.equal(provider.configured, true); |
| 24 | assert.equal(calls, 0); |
| 25 | }); |