#!/usr/bin/env bash
set -e

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

echo "Building solution..."
dotnet build "$SCRIPT_DIR/MicCheck.slnx"

echo "Installing admin dependencies..."
npm --prefix "$SCRIPT_DIR/src/admin" ci --silent

echo "Building admin..."
npm --prefix "$SCRIPT_DIR/src/admin" run build

echo "Running .NET unit tests..."
dotnet test "$SCRIPT_DIR/tests/api/MicCheck.Api.Tests.Unit/MicCheck.Api.Tests.Unit.csproj"

echo "Running Jest tests..."
npm --prefix "$SCRIPT_DIR/src/admin" test

echo "Build and tests complete."
