#!/usr/bin/env bash
# Basic template validation test

set -euo pipefail

echo "Testing Dockerfile templates..."
TEMPLATES_DIR="../templates"
PASSED=0
FAILED=0

for dockerfile in $(find "$TEMPLATES_DIR" -name "*.Dockerfile"); do
    echo -n "Testing $dockerfile... "
    if grep -q "^FROM" "$dockerfile" && grep -q "^USER" "$dockerfile"; then
        echo "✓ PASS"
        ((PASSED++))
    else
        echo "✗ FAIL"
        ((FAILED++))
    fi
done

echo
echo "Results: $PASSED passed, $FAILED failed"
[[ $FAILED -eq 0 ]] && exit 0 || exit 1
