Feature: dynamic command discovery for JSON-RPC and enhanced testing
Some checks failed
Smoke tests / Build and smoke test (push) Failing after 1m2s
Some checks failed
Smoke tests / Build and smoke test (push) Failing after 1m2s
This commit is contained in:
17
TESTING.md
17
TESTING.md
@@ -238,6 +238,13 @@ Run through the checks below before every commit to ensure consistent feature co
|
||||
- [ ] ←→ switches player on Attitudes tab
|
||||
- [ ] 'q' exits TUI
|
||||
|
||||
## JSON-RPC Interface
|
||||
- [ ] `list_commands` returns the currently handleable command list
|
||||
- [ ] New commands added in `commands.rs` are automatically discovered
|
||||
- [ ] `login` accepts an existing player name (requires character to be created first)
|
||||
- [ ] Command output is stripped of ANSI color codes for API consumption
|
||||
- [ ] Verify manually with: `echo '{"_jsonrpc": "2.0", "method": "list_commands", "params": {}, "id": 1}' | nc localhost 2223`
|
||||
|
||||
## Quick Smoke Test Script
|
||||
|
||||
The canonical implementation is **`./run-tests.sh`** (see top of this file). The following is the same sequence for reference; when writing or extending tests, keep `run-tests.sh` and this section in sync.
|
||||
@@ -312,8 +319,18 @@ quit
|
||||
EOF
|
||||
# Verify XP changed (combat happened via ticks)
|
||||
|
||||
# Test 7: JSON-RPC interface and dynamic command list
|
||||
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p 2222 rpctest@localhost <<'EOF'
|
||||
1
|
||||
1
|
||||
quit
|
||||
EOF
|
||||
echo '{"_jsonrpc": "2.0", "method": "login", "params": {"username": "rpctest"}, "id": 1}' | nc -w 2 localhost 2223
|
||||
echo '{"_jsonrpc": "2.0", "method": "list_commands", "params": {}, "id": 2}' | nc -w 2 localhost 2223
|
||||
|
||||
# Cleanup
|
||||
./target/debug/mudtool -d "$TEST_DB" settings set registration_open true
|
||||
./target/debug/mudtool -d "$TEST_DB" players delete smoketest
|
||||
./target/debug/mudtool -d "$TEST_DB" players delete rpctest
|
||||
kill $SERVER_PID
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user