(t *testing.T)
| 25 | } |
| 26 | |
| 27 | func 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 | |
| 49 | func TestGetConversationNotFound(t *testing.T) { |
| 50 | srv := testServer(t) |
nothing calls this directly
no test coverage detected