MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / TestGetConversationShape

Function TestGetConversationShape

internal/httpapi/conversations_test.go:27–47  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

25}
26
27func TestGetConversationShape(t *testing.T) {
28 srv := testServer(t)
29 code, body := getJSON(t, srv.URL+"/v1/agents/support%40acme.com/conversations/conv_1", "good")
30 if code != 200 {
31 t.Fatalf("status %d body %v", code, body)
32 }
33 // Summary fields must be flattened to the top level (embedding), with
34 // participants/labels/messages alongside.
35 if body["conversation_id"] != "conv_1" {
36 t.Fatalf("missing flattened summary fields: %v", body)
37 }
38 parts, _ := body["participants"].([]any)
39 labels, _ := body["labels"].([]any)
40 msgs, _ := body["messages"].([]any)
41 if len(parts) != 2 || len(labels) != 1 || len(msgs) != 1 {
42 t.Fatalf("unexpected detail: participants=%v labels=%v messages=%v", parts, labels, msgs)
43 }
44 if msgs[0].(map[string]any)["message_id"] != "msg_1" {
45 t.Fatalf("unexpected member message: %v", msgs[0])
46 }
47}
48
49func TestGetConversationNotFound(t *testing.T) {
50 srv := testServer(t)

Callers

nothing calls this directly

Calls 2

testServerFunction · 0.85
getJSONFunction · 0.85

Tested by

no test coverage detected