A community based topic aggregation platform built on atproto
1#!/bin/bash
2# Helper script to run tests with the test database
3
4# Colors for output
5GREEN='\033[0;32m'
6RED='\033[0;31m'
7NC='\033[0m' # No Color
8
9echo "🧪 Coves Test Runner"
10echo "==================="
11echo ""
12
13# Check if test database is running
14if ! nc -z localhost 5434 2>/dev/null; then
15 echo -e "${RED}❌ Test database is not running${NC}"
16 echo ""
17 echo "Starting test database..."
18 cd internal/db/test_db_compose && ./start-test-db.sh
19 cd ../../..
20 echo ""
21fi
22
23# Load test environment
24if [ -f .env.test ]; then
25 export $(cat .env.test | grep -v '^#' | xargs)
26fi
27
28# Run tests
29echo "Running tests..."
30echo ""
31
32if [ $# -eq 0 ]; then
33 # No arguments, run all tests
34 go test -v ./...
35else
36 # Pass arguments to go test
37 go test -v "$@"
38fi
39
40TEST_RESULT=$?
41
42if [ $TEST_RESULT -eq 0 ]; then
43 echo ""
44 echo -e "${GREEN}✅ All tests passed!${NC}"
45else
46 echo ""
47 echo -e "${RED}❌ Some tests failed${NC}"
48fi
49
50exit $TEST_RESULT