main
This commit is contained in:
Executable
+76
@@ -0,0 +1,76 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "🧪 Running University Portal test suite..."
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Test results
|
||||
TESTS_PASSED=0
|
||||
TESTS_FAILED=0
|
||||
|
||||
# Function to run a test
|
||||
run_test() {
|
||||
local test_name="$1"
|
||||
local test_command="$2"
|
||||
|
||||
echo -e "${YELLOW}Running: $test_name${NC}"
|
||||
|
||||
if eval "$test_command"; then
|
||||
echo -e "${GREEN}✅ PASSED: $test_name${NC}"
|
||||
TESTS_PASSED=$((TESTS_PASSED + 1))
|
||||
else
|
||||
echo -e "${RED}❌ FAILED: $test_name${NC}"
|
||||
TESTS_FAILED=$((TESTS_FAILED + 1))
|
||||
fi
|
||||
echo ""
|
||||
}
|
||||
|
||||
# Test 1: Environment variables
|
||||
run_test "Environment Configuration" "test -f .env.local && grep -q 'NEXT_PUBLIC_SUPABASE_URL' .env.local"
|
||||
|
||||
# Test 2: Dependencies
|
||||
run_test "Dependencies Check" "npm list --depth=0 > /dev/null 2>&1"
|
||||
|
||||
# Test 3: TypeScript compilation
|
||||
run_test "TypeScript Compilation" "npx tsc --noEmit"
|
||||
|
||||
# Test 4: Next.js build
|
||||
run_test "Next.js Build" "npm run build"
|
||||
|
||||
# Test 5: Database schema
|
||||
run_test "Database Schema Check" "npx prisma validate"
|
||||
|
||||
# Test 6: API routes accessibility
|
||||
run_test "API Routes Structure" "test -f src/app/api/chat/route.ts && test -f src/app/api/survey/route.ts && test -f src/app/api/accessibility/route.ts"
|
||||
|
||||
# Test 7: Essential pages
|
||||
run_test "Essential Pages Check" "test -f src/app/page.tsx && test -f src/app/dashboard/page.tsx && test -f src/app/admin/page.tsx"
|
||||
|
||||
# Test 8: Component files
|
||||
run_test "Core Components Check" "test -f src/components/ChatWidget.tsx && test -f src/components/GDPRBanner.tsx"
|
||||
|
||||
# Test 9: Dockerfile
|
||||
run_test "Docker Configuration" "test -f Dockerfile && test -f docker-compose.yml"
|
||||
|
||||
# Test 10: Demo data
|
||||
run_test "Demo Data Check" "test -f demo-accounts.json && test -f prisma/seed.ts"
|
||||
|
||||
# Summary
|
||||
echo "=========================="
|
||||
echo "Test Results Summary:"
|
||||
echo -e "✅ Passed: ${GREEN}$TESTS_PASSED${NC}"
|
||||
echo -e "❌ Failed: ${RED}$TESTS_FAILED${NC}"
|
||||
echo "=========================="
|
||||
|
||||
if [ $TESTS_FAILED -eq 0 ]; then
|
||||
echo -e "${GREEN}🎉 All tests passed! The application is ready for demo.${NC}"
|
||||
exit 0
|
||||
else
|
||||
echo -e "${RED}⚠️ Some tests failed. Please check the output above.${NC}"
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user