From 0e7ab2a22fdc071858e0a8d8f19dc73145cf386d Mon Sep 17 00:00:00 2001 From: Lectom Date: Wed, 27 May 2026 12:31:45 +0900 Subject: [PATCH] test: assert userfront boot warmup policy --- test/frontend_dev_bind_mount_policy_test.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/test/frontend_dev_bind_mount_policy_test.sh b/test/frontend_dev_bind_mount_policy_test.sh index 9df97d6c..a0ad2300 100644 --- a/test/frontend_dev_bind_mount_policy_test.sh +++ b/test/frontend_dev_bind_mount_policy_test.sh @@ -45,12 +45,22 @@ grep -Fq -- "--dart-define=CLIENT_LOG_DEBUG=" "$USERFRONT_DEV_SERVER" || fail "u grep -Fq -- "--dart-define=APP_ENV=" "$USERFRONT_DEV_SERVER" || fail "userfront dev server must pass app env through dart-define" grep -Fq -- "--dart-define=USERFRONT_URL=" "$USERFRONT_DEV_SERVER" || fail "userfront dev server must pass userfront URL through dart-define" grep -Fq -- 'USERFRONT_FLUTTER_RUN_FLAGS' "$USERFRONT_DEV_SERVER" || fail "userfront dev server must accept optional Flutter run flags" +grep -Fq -- 'USERFRONT_FLUTTER_RUN_FLAGS="${USERFRONT_FLUTTER_RUN_FLAGS:---debug}"' "$USERFRONT_DEV_SERVER" || fail "userfront dev server must keep Flutter debug mode as the default" +grep -Fq -- 'warm_userfront_once' "$USERFRONT_DEV_SERVER" || fail "userfront dev server must run a one-shot boot warmup" +grep -Fq -- 'USERFRONT_BOOT_WARMUP_LOCALES' "$USERFRONT_DEV_SERVER" || fail "userfront boot warmup must declare the language matrix" +grep -Fq -- 'USERFRONT_BOOT_WARMUP_VIEWPORTS' "$USERFRONT_DEV_SERVER" || fail "userfront boot warmup must declare the viewport matrix" +grep -Fq -- 'Accept-Language:' "$USERFRONT_DEV_SERVER" || fail "userfront boot warmup must GET each route with the locale header" +grep -Fq -- 'Viewport-Width:' "$USERFRONT_DEV_SERVER" || fail "userfront boot warmup must GET each route with viewport width metadata" +grep -Fq -- '/signin' "$USERFRONT_DEV_SERVER" || fail "userfront boot warmup must cover signin routes" +grep -Fq -- '/flutter_bootstrap.js' "$USERFRONT_DEV_SERVER" || fail "userfront boot warmup must load the Flutter bootstrap entrypoint" +grep -Fq -- '/main.dart.mjs' "$USERFRONT_DEV_SERVER" || fail "userfront boot warmup must load the wasm JS module entrypoint" +grep -Fq -- '/main.dart.wasm' "$USERFRONT_DEV_SERVER" || fail "userfront boot warmup must load the wasm module" assert_contains 'CLIENT_LOG_DEBUG=${CLIENT_LOG_DEBUG:-false}' assert_contains 'BACKEND_URL=${BACKEND_URL:-}' assert_contains 'USERFRONT_URL=${USERFRONT_URL}' assert_contains 'USERFRONT_FLUTTER_RUN_FLAGS=${USERFRONT_FLUTTER_RUN_FLAGS:-}' -if grep -Fq -- "--debug" "$USERFRONT_DEV_SERVER"; then - fail "make dev must not hard-code Flutter debug mode in the userfront dev server" +if grep -Fq -- "while true" "$USERFRONT_DEV_SERVER"; then + fail "userfront boot warmup must not run as a periodic health check" fi if grep -Fq -- "--release" "$USERFRONT_DEV_SERVER"; then fail "userfront dev server must not run Flutter in release mode"