Accounts 1.9.0, @crosscode/demo 1.0.0: messaging.get, WhatsApp opt-out, demo scenarios
Accounts 1.9.0 (one migration): - messaging.get (sealed settings) and the messaging.changed hint to products that asked, on admin or product changes - the WhatsApp opt-out for every product: whatsapp.optout, Accounts' own WAWP webhook, WhatsAppOptOut kept per number, whatsapp_opted_out in user.updated, no WhatsApp from Accounts to an opted-out person, "Turn WhatsApp back on" - demo scenarios: npm run demo -- --profile <scenario> --force replaces the church profile (with an SVG logo and icon at /api/demo-assets/) and the demo people, ids kept across loads @crosscode/demo 1.0.0 (new): the eight scenarios' churches, people and logos. crosscode script: crosscode demo <church> accounts, --scenario on every demo, Accounts installs and builds packages/demo. Checked on PostgreSQL 18: migrations, scenario loads, opt-out, npm run demo. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+48
-1
@@ -19,6 +19,15 @@ setup() {
|
||||
touch "$TMP/sites/hope/events/apps/events/backend/scripts/set-demo.js"
|
||||
mkdir -p "$TMP/sites/hope/website/apps/website/backend/src/demo"
|
||||
touch "$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"
|
||||
cat > "$CROSSCODE_HOME/products/accounts.sh" <<EOF3
|
||||
accounts_app() { printf '%s/apps/accounts' "\$1"; }
|
||||
accounts_backup() { echo "backup \$2" >> "$CALLS"; [ -z "\${FAIL_BACKUP:-}" ]; }
|
||||
accounts_reload() { echo "reload \$2" >> "$CALLS"; }
|
||||
accounts_health_url() { echo http://127.0.0.1:5200/api/health; }
|
||||
accounts_expected_version() { echo 1.9.0; }
|
||||
EOF3
|
||||
cat > "$CROSSCODE_HOME/products/website.sh" <<EOF2
|
||||
website_app() { printf '%s/apps/website' "\$1"; }
|
||||
website_backup() { echo "backup \$2" >> "$CALLS"; [ -z "\${FAIL_BACKUP:-}" ]; }
|
||||
@@ -35,7 +44,7 @@ events_expected_version() { echo 2.4.1; }
|
||||
EOF
|
||||
require_root() { :; }
|
||||
load_church() { [ "$1" = hope ] || die "There's no church $1 here."; }
|
||||
church_has_product() { [ "$1" = events ] || [ "$1" = website ]; }
|
||||
church_has_product() { [ "$1" = events ] || [ "$1" = website ] || [ "$1" = accounts ]; }
|
||||
pvar() { case "$2" in DIR) echo "$TMP/sites/hope/$1" ;; USER) echo "cc-hope-$1" ;; esac; }
|
||||
checkout_ref() { echo "$2@1.0.0"; }
|
||||
wait_for_version() { echo "wait $2" >> "$CALLS"; }
|
||||
@@ -114,3 +123,41 @@ wait 1.3.0" ]
|
||||
[[ "$output" == *"no demo profiles"* ]]
|
||||
[ ! -s "$CALLS" ]
|
||||
}
|
||||
|
||||
@test "accounts: backup, then the scenario's church and people as the site's user, then a reload" {
|
||||
run cmd_demo hope accounts --profile community-family --scenario community-family
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$(cat "$CALLS")" = "backup cc-hope-accounts
|
||||
run cc-hope-accounts sites/hope/accounts/apps/accounts/backend npm run --silent demo -- --profile community-family --force
|
||||
reload cc-hope-accounts
|
||||
wait 1.9.0" ]
|
||||
}
|
||||
|
||||
@test "accounts: only a scenario, no admin email, and only a release that has scenarios" {
|
||||
run cmd_demo hope accounts --profile small
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" == *"clean-campus"* ]]
|
||||
run cmd_demo hope accounts --profile bold-youth --admin-email jane@hope.test
|
||||
[ "$status" -eq 1 ]
|
||||
rm "$TMP/sites/hope/accounts/apps/accounts/backend/scripts/demo.ts"
|
||||
run cmd_demo hope accounts --profile bold-youth
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" == *"no demo scenarios"* ]]
|
||||
[ ! -s "$CALLS" ]
|
||||
}
|
||||
|
||||
@test "--scenario: a known one, and the profile must be the scenario's" {
|
||||
run cmd_demo hope website --profile bold-plant --scenario bold-youth
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" == *"loads the bold-youth profile"* ]]
|
||||
run cmd_demo hope accounts --profile bold-youth --scenario nowhere
|
||||
[ "$status" -eq 1 ]
|
||||
run cmd_demo hope website --profile bold-youth --scenario bold-youth
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@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 ]
|
||||
[[ "$(cat "$CALLS")" != *"reload"* ]]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user