diff --git a/Makefile b/Makefile index e2a92f7c2..b6b00aebb 100644 --- a/Makefile +++ b/Makefile @@ -70,6 +70,7 @@ format-frontend: npm --prefix $(FRONTEND_DIR) run format test: + @./scripts/ensure_test_assets.sh @echo "Running backend tests (excluding tmp tooling)..." go test $$(go list ./... | grep -v '/tmp$$') diff --git a/scripts/ensure_test_assets.sh b/scripts/ensure_test_assets.sh new file mode 100755 index 000000000..223698dba --- /dev/null +++ b/scripts/ensure_test_assets.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# scripts/ensure_test_assets.sh +# Ensures that frontend assets exist for Go embed requirements during testing. + +ASSET_DIR="internal/api/frontend-modern/dist" +INDEX_FILE="$ASSET_DIR/index.html" + +# If directory doesn't exist, create it +if [ ! -d "$ASSET_DIR" ]; then + echo "Test assets missing. Creating dummy frontend assets in $ASSET_DIR..." + mkdir -p "$ASSET_DIR" +fi + +# If index.html doesn't exist, create a dummy one +if [ ! -f "$INDEX_FILE" ]; then + echo "Creating dummy index.html for testing..." + cat > "$INDEX_FILE" < + +Test Asset +

Pulse Test Asset

+ +EOF +fi