accesscodes/test-integrated-whitelist.sh
2025-12-20 07:47:49 +00:00

65 lines
1.9 KiB
Bash

#!/bin/bash
# Test script for the integrated whitelist with player resolver
# This tests the full flow: resolve player -> send UUID/XUID to server
echo "Testing integrated whitelist with player resolver..."
# Test Java player with valid access code (you'll need to replace with actual access code)
echo -e "\n=== Testing Java Player Resolution + Whitelist ==="
curl -X POST http://localhost:3000/api/whitelist \
-H "Content-Type: application/json" \
-d '{
"javaName": "Notch",
"preference": "java",
"accessCode": "YOUR_ACCESS_CODE_HERE"
}' \
| jq .
# Test Bedrock player with valid access code
echo -e "\n=== Testing Bedrock Player Resolution + Whitelist ==="
curl -X POST http://localhost:3000/api/whitelist \
-H "Content-Type: application/json" \
-d '{
"bedrockName": "TestGamertag",
"preference": "bedrock",
"accessCode": "YOUR_ACCESS_CODE_HERE"
}' \
| jq .
# Test both platforms
echo -e "\n=== Testing Both Platforms Resolution + Whitelist ==="
curl -X POST http://localhost:3000/api/whitelist \
-H "Content-Type: application/json" \
-d '{
"javaName": "Notch",
"bedrockName": "TestGamertag",
"preference": "both",
"accessCode": "YOUR_ACCESS_CODE_HERE"
}' \
| jq .
# Test invalid access code
echo -e "\n=== Testing Invalid Access Code ==="
curl -X POST http://localhost:3000/api/whitelist \
-H "Content-Type: application/json" \
-d '{
"javaName": "Notch",
"preference": "java",
"accessCode": "invalid_code"
}' \
| jq .
# Test invalid username
echo -e "\n=== Testing Invalid Username ==="
curl -X POST http://localhost:3000/api/whitelist \
-H "Content-Type: application/json" \
-d '{
"javaName": "nonexistentplayer12345",
"preference": "java",
"accessCode": "YOUR_ACCESS_CODE_HERE"
}' \
| jq .
echo -e "\n=== Test completed ==="
echo "Note: Replace YOUR_ACCESS_CODE_HERE with a valid access code from your system"