mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-10-15 02:16:56 +00:00
test(contracts): add /v1/agents HTTP contract test
This commit is contained in:
1 parent
1d90d2c453
commit
cc21384ff4
1 file changed
+25
@@ -0,0 +1,25 @@
|
||||
//go:build integration
|
||||
|
||||
package http_api
|
||||
|
||||
import "testing"
|
||||
|
||||
// CONTRACT: /v1/agents response MUST include agents array.
|
||||
func TestContract_HTTP_AgentsList(t *testing.T) {
|
||||
baseURL, token := getTestServer(t)
|
||||
client := newHTTPClient(baseURL, token)
|
||||
|
||||
resp := client.get(t, "/v1/agents")
|
||||
|
||||
assertField(t, resp, "agents", "array")
|
||||
|
||||
agents, ok := resp["agents"].([]any)
|
||||
if !ok || len(agents) == 0 {
|
||||
t.Log("No agents - skipping field checks")
|
||||
return
|
||||
}
|
||||
|
||||
agent := agents[0].(map[string]any)
|
||||
assertField(t, agent, "id", "string")
|
||||
assertField(t, agent, "agent_key", "string")
|
||||
}
|
||||
Reference in new issue
Block a user