File size: 2,206 Bytes
5a5589e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/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"