#!/bin/bash
# ROUP pre-push hook - runs test.sh before allowing push
#
# This hook is called by "git push" after it has checked the remote status,
# but before anything has been pushed. If this script exits with a non-zero
# status nothing will be pushed.

set -e

echo "========================================="
echo "  Running pre-push tests..."
echo "========================================="
echo ""

# Run the comprehensive test suite
if ! ./test.sh; then
    echo ""
    echo "========================================="
    echo "  ❌ Tests failed - push aborted!"
    echo "========================================="
    exit 1
fi

echo ""
echo "========================================="
echo "  ✅ All tests passed - proceeding with push"
echo "========================================="
echo ""

exit 0
