gcli2api / internal /upstream /school_mp_test.go
a3216's picture
chore: 同步到上游 1.12.0-panel + 凭证同步/独立启动器/保活
6d60378 verified
Raw History Blame Contribute Delete
1.04 kB
package upstream
import (
"encoding/json"
"strings"
"testing"
"github.com/linguo2625469/workbuddy2api-panel/internal/auth"
)
func TestMPEventBase(t *testing.T) {
a := &auth.Auth{UID: "u-1", Nickname: "测试"}
base := mpEventBase(a)
for _, k := range []string{"ideType", "extName", "ideName", "platform", "userId"} {
if _, ok := base[k]; !ok {
t.Errorf("missing common field %s", k)
}
}
if base["ideType"] != "WorkBuddy_MP" || base["extName"] != "workbuddy-mp" {
t.Errorf("fingerprint ideType=%v extName=%v", base["ideType"], base["extName"])
}
}
func TestSchoolChatTimesEvents(t *testing.T) {
ev := SchoolChatTimesEvents("conv-1")
if ev["eventCode"] != "chat_request_send" {
t.Errorf("eventCode=%v", ev["eventCode"])
}
if ev["conversationId"] != "conv-1" || ev["codebuddy.session_id"] != "conv-1" {
t.Errorf("conversation join fields missing: %v", ev)
}
b, _ := json.Marshal(ev)
if !strings.Contains(string(b), "agentName") {
t.Error("agentName missing")
}
}