LifeMate — Personal, Family & Learning Companion

infra/lifeguide-github-pages-qa
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 51 lines 2.79 KB
Raw
1 import test from 'node:test';
2 import assert from 'node:assert/strict';
3 import { readFile } from 'node:fs/promises';
4 import { execFile } from 'node:child_process';
5 import { promisify } from 'node:util';
6
7 const read = path => readFile(new URL(path, import.meta.url), 'utf8');
8 const run = promisify(execFile);
9
10 test('LifeGuide GitHub Pages QA supports repo-path smoke before a custom domain', async () => {
11 const script = await read('../../scripts/build-github-pages-qa.sh');
12 const sharedBuilder = await read('../../scripts/build-cloudflare-pages-qa.sh');
13 assert.match(script, /LIFEGUIDE_PAGES_BASE_HREF:-\/LifeMate\//);
14 assert.match(script, /\/LifeMate\/\|\//);
15 assert.match(script, /LIFEGUIDE_FLUTTER_BASE_HREF="\$LIFEGUIDE_PAGES_BASE_HREF"/);
16 assert.match(sharedBuilder, /LIFEGUIDE_FLUTTER_BASE_HREF:-\//);
17 assert.match(sharedBuilder, /--base-href "\$LIFEGUIDE_FLUTTER_BASE_HREF"/);
18 assert.match(script, /bash scripts\/build-cloudflare-pages-qa\.sh/);
19 assert.match(script, /touch "\$out\/\.nojekyll"/);
20 assert.match(script, /const expectedApiBase = base === '\/' \? '\/api' : base \+ 'api'/);
21 assert.match(script, /config\.apiBaseUrl = expectedApiBase/);
22 assert.match(script, /config\.apiFallbackUrls\.length !== 0/);
23 assert.match(script, /<base href="/);
24 assert.match(script, /site-check\.txt/);
25 assert.doesNotMatch(script, /KAVENEGAR_API_KEY|DATABASE_URL|SUPABASE_SERVICE_ROLE_KEY|\.up\.railway\.app/);
26 });
27
28 test('LifeGuide Pages QA refuses unsupported base URLs before invoking Flutter', async () => {
29 const script = new URL('../../scripts/build-github-pages-qa.sh', import.meta.url).pathname;
30 await assert.rejects(
31 () => run('bash', [script], {env: {...process.env, LIFEGUIDE_PAGES_BASE_HREF: '/untrusted/'}}),
32 error => error.code === 2 && /Unsupported LifeGuide Pages QA base href/.test(error.stderr),
33 );
34 });
35
36 test('GitHub Pages QA fails before an expensive Flutter build when Pages is off', async () => {
37 const workflow = await read('../../.github/workflows/lifeguide-github-pages-qa.yml');
38 assert.match(workflow, /infra\/lifeguide-github-pages-qa/);
39 assert.match(workflow, /actions\/configure-pages@v5/);
40 assert.match(workflow, /LIFEGUIDE_PAGES_BASE_HREF: \/LifeMate\//);
41 assert.match(workflow, /scripts\/build-github-pages-qa\.sh/);
42 assert.match(workflow, /actions\/upload-pages-artifact@v4/);
43 assert.match(workflow, /actions\/deploy-pages@v4/);
44 assert.match(workflow, /pages: write/);
45 assert.match(workflow, /id-token: write/);
46 assert.match(workflow, /github-pages/);
47 assert(workflow.indexOf('actions/configure-pages@v5') <
48 workflow.indexOf('scripts/build-github-pages-qa.sh'),
49 'Configure-pages must fail before Flutter fetch/build when disabled.');
50 assert.doesNotMatch(workflow, /main\]|deployment-static|KAVENEGAR_API_KEY|DATABASE_URL|SUPABASE_SERVICE_ROLE_KEY/);
51 });