crosscode: the Church App (app.sh, add, demo) and the App's changelog
scripts/products/app.sh and app.env.template.json; app in SUPPORTED_PRODUCTS; crosscode add <church> app (Accounts first); crosscode demo <church> app --profile <s>, and the App's turn, last, in a whole demo scenario. app.bats and demo.bats; app.sh linted. The full bats suite wasn't run (stopped for low memory); app.bats and demo.bats pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+55
-5
@@ -21,6 +21,15 @@ setup() {
|
||||
echo "scenarioTeam" > "$TMP/sites/hope/website/apps/website/backend/src/demo/seeds.ts"
|
||||
mkdir -p "$TMP/sites/hope/accounts/apps/accounts/backend/scripts"
|
||||
touch "$TMP/sites/hope/accounts/apps/accounts/backend/scripts/demo.ts"
|
||||
mkdir -p "$TMP/sites/hope/app/apps/app/backend/scripts"
|
||||
touch "$TMP/sites/hope/app/apps/app/backend/scripts/demo.ts"
|
||||
cat > "$CROSSCODE_HOME/products/app.sh" <<EOF4
|
||||
app_app() { printf '%s/apps/app' "\$1"; }
|
||||
app_backup() { echo "backup \$2" >> "$CALLS"; [ -z "\${FAIL_BACKUP:-}" ]; }
|
||||
app_reload() { echo "reload \$2" >> "$CALLS"; }
|
||||
app_health_url() { echo http://127.0.0.1:5400/api/health; }
|
||||
app_expected_version() { echo \${APP_VERSION:-1.0.0}; }
|
||||
EOF4
|
||||
cat > "$CROSSCODE_HOME/products/accounts.sh" <<EOF3
|
||||
accounts_app() { printf '%s/apps/accounts' "\$1"; }
|
||||
accounts_backup() { echo "backup \$2" >> "$CALLS"; [ -z "\${FAIL_BACKUP:-}" ]; }
|
||||
@@ -172,13 +181,36 @@ wait 1.9.0" ]
|
||||
[[ "$(cat "$CALLS")" == *"demo -- --profile bold-youth --force"* ]]
|
||||
}
|
||||
|
||||
@test "the App's demo (agent 1.7.0 sends it) is refused clearly until App 1.0.0" {
|
||||
run cmd_demo hope app --profile community-family --scenario community-family
|
||||
@test "app: backup, then the scenario as the App's user, then a reload" {
|
||||
HAS="accounts app" run cmd_demo hope app --profile community-family --scenario community-family
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$(cat "$CALLS")" = "backup cc-hope-app
|
||||
run cc-hope-app sites/hope/app/apps/app/backend npm run --silent demo -- --profile community-family --scenario community-family --force
|
||||
reload cc-hope-app
|
||||
wait 1.0.0" ]
|
||||
}
|
||||
|
||||
@test "app: only a scenario, no admin email, an App installed, and a release that has the demo" {
|
||||
HAS="accounts app" run cmd_demo hope app --profile small
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" == *"comes with App 1.0.0"* ]]
|
||||
HAS="accounts app" run cmd_demo hope app --profile bold-plant --admin-email jane@hope.test
|
||||
[ "$status" -eq 1 ]
|
||||
HAS="accounts" run cmd_demo hope app --profile bold-plant
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" == *"has no Church App"* ]]
|
||||
rm "$TMP/sites/hope/app/apps/app/backend/scripts/demo.ts"
|
||||
HAS="accounts app" run cmd_demo hope app --profile bold-plant
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" == *"has no demo (1.0.0 or later has)"* ]]
|
||||
[ ! -s "$CALLS" ]
|
||||
}
|
||||
|
||||
@test "app: a failed backup stops it before the data is touched" {
|
||||
HAS="accounts app" FAIL_BACKUP=1 run cmd_demo hope app --profile bold-plant
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$(cat "$CALLS")" != *"run "* ]]
|
||||
}
|
||||
|
||||
@test "a failed Accounts demo isn't followed by a reload" {
|
||||
FAIL_SEED=1 run cmd_demo hope accounts --profile clean-modern
|
||||
[ "$status" -eq 1 ]
|
||||
@@ -224,10 +256,28 @@ cc-hope-website" ]
|
||||
[[ "$(cat "$CALLS")" != *"cc-hope-website"* ]]
|
||||
}
|
||||
|
||||
@test "seed-scenario: an App installed is refused (its demo comes with App 1.0.0), nothing changed" {
|
||||
@test "seed-scenario: the App loads last, after Accounts, Events and the Website" {
|
||||
HAS="accounts events website app" EVENTS_VERSION=3.8.0 WEBSITE_VERSION=1.8.0 run cmd_demo hope --scenario clean-campus
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$(grep '^run' "$CALLS" | cut -d' ' -f2)" = "cc-hope-accounts
|
||||
cc-hope-events
|
||||
cc-hope-website
|
||||
cc-hope-app" ]
|
||||
[[ "$(cat "$CALLS")" == *"run cc-hope-app sites/hope/app/apps/app/backend npm run --silent demo -- --profile clean-campus --scenario clean-campus --force"* ]]
|
||||
}
|
||||
|
||||
@test "seed-scenario: only Accounts and the App, the rest skipped" {
|
||||
HAS="accounts app" run cmd_demo hope --scenario bold-plant
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" == *"Not installed, so skipped: events website"* ]]
|
||||
[ "$(grep '^run' "$CALLS" | cut -d' ' -f2)" = "cc-hope-accounts
|
||||
cc-hope-app" ]
|
||||
}
|
||||
|
||||
@test "seed-scenario: an App before 1.0.0 stops it before anything changes" {
|
||||
HAS="accounts app" APP_VERSION=0.9.0 run cmd_demo hope --scenario bold-plant
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" == *"comes with App 1.0.0"* ]]
|
||||
[[ "$output" == *"The App is 0.9.0 here: a demo scenario needs 1.0.0 or later"* ]]
|
||||
[ ! -s "$CALLS" ]
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user