Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions scripts/setup_storefront_env
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,15 @@ EOF
# Buyer identity defaults
EOF
write_env_assignment EMAIL "$EMAIL_VALUE"
write_env_assignment ADDRESS_1 "$ADDRESS_1_VALUE"
write_env_assignment ADDRESS_2 "$ADDRESS_2_VALUE"
write_env_assignment CITY "$CITY_VALUE"
write_env_assignment COMPANY "$COMPANY_VALUE"
write_env_assignment COUNTRY "$COUNTRY_VALUE"
write_env_assignment FIRST_NAME "$FIRST_NAME_VALUE"
write_env_assignment LAST_NAME "$LAST_NAME_VALUE"
write_env_assignment PROVINCE "$PROVINCE_VALUE"
write_env_assignment ZIP "$ZIP_VALUE"
write_env_assignment PHONE "$PHONE_VALUE"
}

Expand Down
13 changes: 13 additions & 0 deletions scripts/test_setup_storefront_env
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ assert_not_contains() {
fi
}

assert_buyer_identity_keys() {
local path="$1"
local key

for key in EMAIL ADDRESS_1 ADDRESS_2 CITY COMPANY COUNTRY FIRST_NAME LAST_NAME PROVINCE ZIP PHONE; do
grep -Eq "^${key} ?=" "$path" || fail "buyer identity key is missing: $path: $key"
done
}

assert_output_is_sanitized() {
local output_path="$1"
local value
Expand Down Expand Up @@ -167,6 +176,10 @@ test_sync_and_check() {
assert_not_contains "$fixture/platforms/swift/Samples/ShopifyAcceleratedCheckoutsApp/Storefront.xcconfig" "CUSTOMER_ACCOUNT_API_CLIENT_ID"
assert_not_contains "$fixture/platforms/swift/Samples/ShopifyAcceleratedCheckoutsApp/Storefront.xcconfig" "EMAIL"

assert_buyer_identity_keys "$fixture/platforms/android/samples/CheckoutKitAndroidDemo/.env"
assert_buyer_identity_keys "$fixture/platforms/react-native/sample/.env"
assert_buyer_identity_keys "$fixture/platforms/swift/Samples/CheckoutKitSwiftDemo/Storefront.xcconfig"

"$fixture/scripts/setup_storefront_env" --check >"$output" 2>&1
assert_output_is_sanitized "$output"

Expand Down
Loading