#!/usr/bin/env sh
set -eu

ROOT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)"

if command -v go >/dev/null 2>&1; then
  (cd "$ROOT_DIR/services/core" && go test ./...)
else
  echo "skip services/core: go not found"
fi

if command -v flutter >/dev/null 2>&1 && [ -f "$ROOT_DIR/apps/client/pubspec.yaml" ] && [ -d "$ROOT_DIR/apps/client/test" ]; then
  (cd "$ROOT_DIR/apps/client" && flutter test)
else
  echo "skip apps/client: flutter not found or no test scaffold"
fi
