LifeMate — Personal, Family & Learning Companion

feat/weekly-planner-android
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
js 32 lines 1.31 KB
Raw
1 import test from 'node:test';
2 import assert from 'node:assert/strict';
3 import fs from 'node:fs';
4
5 const operations = fs.readFileSync(new URL('../src/operations.js', import.meta.url), 'utf8');
6 const entrypoint = fs.readFileSync(new URL('../src/entrypoint.js', import.meta.url), 'utf8');
7
8 test('operations layer provides correlation, safe telemetry and security headers', () => {
9 assert.match(operations, /x-request-id/i);
10 assert.match(operations, /x-content-type-options/i);
11 assert.match(operations, /x-frame-options/i);
12 assert.match(operations, /referrer-policy/i);
13 assert.match(operations, /durationMs/);
14 assert.doesNotMatch(operations, /req\.body/);
15 assert.doesNotMatch(operations, /authorization/i);
16 });
17
18 test('operations layer defines bounded rate-limit profiles and retry-after', () => {
19 assert.match(operations, /120/);
20 assert.match(operations, /10\s*\*\s*60/);
21 assert.match(operations, /30/);
22 assert.match(operations, /Retry-After/);
23 assert.match(operations, /rate_limited/);
24 });
25
26 test('production entrypoint exposes liveness and database readiness separately', () => {
27 assert.match(entrypoint, /outer\.get\('\/live'/);
28 assert.match(entrypoint, /outer\.get\('\/ready'/);
29 assert.match(entrypoint, /select 1 as ok/);
30 assert.match(entrypoint, /requestContext/);
31 assert.match(entrypoint, /rateLimit/);
32 });