#!/usr/bin/env bash
# Run the config/state regression tests inside the miku-bot Docker container.
#
# Usage:
#   ./bot/tests/run_tests.sh          # build + run
#   ./bot/tests/run_tests.sh --no-build  # skip rebuild
set -euo pipefail

cd "$(dirname "$0")/../.."  # repo root

if [[ "${1:-}" != "--no-build" ]]; then
    echo "Building miku-bot image..."
    docker compose build miku-bot
fi

echo ""
echo "Running config/state regression tests..."
echo ""

docker run --rm \
    -v "$(pwd)/config.yaml:/config.yaml:ro" \
    -v "$(pwd)/bot/tests:/app/tests:ro" \
    -e DISCORD_BOT_TOKEN=test_token \
    miku-discord-miku-bot \
    python tests/test_config_state.py
