| package client | |
| import "testing" | |
| func TestExtractCreateSessionIDSupportsLegacyShape(t *testing.T) { | |
| resp := map[string]any{ | |
| "data": map[string]any{ | |
| "biz_data": map[string]any{ | |
| "id": "legacy-session-id", | |
| }, | |
| }, | |
| } | |
| if got := extractCreateSessionID(resp); got != "legacy-session-id" { | |
| t.Fatalf("expected legacy session id, got %q", got) | |
| } | |
| } | |
| func TestExtractCreateSessionIDSupportsNestedChatSessionShape(t *testing.T) { | |
| resp := map[string]any{ | |
| "data": map[string]any{ | |
| "biz_data": map[string]any{ | |
| "chat_session": map[string]any{ | |
| "id": "nested-session-id", | |
| "model_type": "default", | |
| }, | |
| }, | |
| }, | |
| } | |
| if got := extractCreateSessionID(resp); got != "nested-session-id" { | |
| t.Fatalf("expected nested session id, got %q", got) | |
| } | |
| } | |