#!/bin/bash # Test script for Hugging Face Space deployment SERVER_URL="https://detomo-houzou-notification-server.hf.space" echo "๐Ÿงช Testing Houzou Medical Notification Server" echo "Server URL: $SERVER_URL" echo "=========================================" # Test 1: Health check echo "1. Health Check:" curl -s "$SERVER_URL" | jq '.' 2>/dev/null || curl -s "$SERVER_URL" echo -e "\n" # Test 2: Test Firebase connectivity echo "2. Firebase Test:" curl -s "$SERVER_URL/test-firebase" | jq '.' 2>/dev/null || curl -s "$SERVER_URL/test-firebase" echo -e "\n" # Test 3: Check devices echo "3. Registered Devices:" curl -s "$SERVER_URL/devices" | jq '.' 2>/dev/null || curl -s "$SERVER_URL/devices" echo -e "\n" # Test 4: Register test device echo "4. Register Test Device:" curl -s -X POST "$SERVER_URL/register-token" \ -H "Content-Type: application/json" \ -d '{ "token": "test-token-123", "deviceId": "test-device-123", "platform": "test", "appVersion": "1.0.0" }' | jq '.' 2>/dev/null || curl -s -X POST "$SERVER_URL/register-token" \ -H "Content-Type: application/json" \ -d '{ "token": "test-token-123", "deviceId": "test-device-123", "platform": "test", "appVersion": "1.0.0" }' echo -e "\n" # Test 5: Check devices again echo "5. Devices After Registration:" curl -s "$SERVER_URL/devices" | jq '.' 2>/dev/null || curl -s "$SERVER_URL/devices" echo -e "\n" # Test 6: Send test notification echo "6. Test Broadcast Notification:" curl -s -X POST "$SERVER_URL/send-broadcast-notification" \ -H "Content-Type: application/json" \ -d '{ "title": "๐Ÿงช Test Notification", "body": "This is a test from deployment script", "type": "home" }' | jq '.' 2>/dev/null || curl -s -X POST "$SERVER_URL/send-broadcast-notification" \ -H "Content-Type: application/json" \ -d '{ "title": "๐Ÿงช Test Notification", "body": "This is a test from deployment script", "type": "home" }' echo -e "\n" echo "=========================================" echo "โœ… Testing completed!" echo "๐Ÿ’ก Note: Notification send may fail with test tokens (expected)" echo "๐Ÿ”„ Server is using in-memory storage, devices will reset on restart"