Download internal/upstream/school_mp_test.go from a3216/gcli2api: direct link, hf CLI and curl.
- Browser
- Download file 1.04 kB
-
https://huggingface.co/spaces/a3216/gcli2api/resolve/main/internal/upstream/school_mp_test.go
- Command line
-
hf download hf://spaces/a3216/gcli2api/internal/upstream/school_mp_test.go
-
curl -L -o school_mp_test.go https://huggingface.co/spaces/a3216/gcli2api/resolve/main/internal/upstream/school_mp_test.go
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") | |
| } | |
| } | |