Files
dbis_core-lite/tests/exports/run-export-tests.sh
2026-02-09 21:51:45 -08:00

58 lines
2.1 KiB
Bash
Executable File

#!/bin/bash
# Export Functionality Test Runner
# Runs all export-related tests with proper setup
set -e
echo "=========================================="
echo "Export Functionality Test Suite"
echo "=========================================="
echo ""
# Check if test database is configured
if [ -z "$TEST_DATABASE_URL" ]; then
echo "⚠️ WARNING: TEST_DATABASE_URL not set. Some integration tests may fail."
echo " Set TEST_DATABASE_URL in .env.test or environment"
echo ""
fi
# Run unit tests (no database required)
echo "📦 Running Unit Tests (No Database Required)..."
echo "----------------------------------------"
npm test -- tests/unit/exports/utils/export-validator.test.ts \
tests/unit/exports/formats/format-detector.test.ts \
tests/unit/exports/containers/raw-iso-container.test.ts \
tests/unit/exports/containers/xmlv2-container.test.ts \
tests/unit/exports/containers/rje-container.test.ts \
--passWithNoTests
echo ""
echo "📦 Running Unit Tests (Database Required)..."
echo "----------------------------------------"
npm test -- tests/unit/exports/identity-map.test.ts --passWithNoTests || {
echo "⚠️ Identity map tests require database setup"
}
echo ""
echo "🔗 Running Integration Tests (Database Required)..."
echo "----------------------------------------"
npm test -- tests/integration/exports/export-service.test.ts \
tests/integration/exports/export-routes.test.ts \
--passWithNoTests || {
echo "⚠️ Integration tests require database setup"
}
echo ""
echo "=========================================="
echo "Test Summary"
echo "=========================================="
echo "✅ Unit tests (no DB): Validator, Format Detector, Containers"
echo "⚠️ Unit tests (DB): Identity Map (requires TEST_DATABASE_URL)"
echo "⚠️ Integration tests: Export Service, Routes (requires TEST_DATABASE_URL)"
echo ""
echo "To run all tests with database:"
echo " export TEST_DATABASE_URL='postgresql://user:pass@localhost:5432/dbis_core_test'"
echo " npm test -- tests/unit/exports tests/integration/exports"
echo ""