mirror of
https://github.com/CJackHwang/ds2api.git
synced 2026-05-02 07:25:26 +08:00
35 lines
776 B
Go
35 lines
776 B
Go
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)
|
|
}
|
|
}
|