MCPcopy
hub / github.com/larksuite/cli / TestImChatBotAddedProcessor_Compact

Function TestImChatBotAddedProcessor_Compact

shortcuts/event/processor_im_test.go:149–175  ·  view source on GitHub ↗

--- im.chat.member.bot.added_v1 / deleted_v1 ---

(t *testing.T)

Source from the content-addressed store, hash-verified

147// --- im.chat.member.bot.added_v1 / deleted_v1 ---
148
149func TestImChatBotAddedProcessor_Compact(t *testing.T) {
150 p := NewImChatBotAddedProcessor()
151 if p.EventType() != "im.chat.member.bot.added_v1" {
152 t.Fatalf("EventType = %q", p.EventType())
153 }
154 raw := makeRawEvent("im.chat.member.bot.added_v1", `{
155 "chat_id": "oc_bot",
156 "operator_id": {"open_id": "ou_operator"},
157 "external": false
158 }`)
159 result, ok := p.Transform(context.Background(), raw, TransformCompact).(map[string]interface{})
160 if !ok {
161 t.Fatal("compact should return map")
162 }
163 if result["action"] != "added" {
164 t.Errorf("action = %v", result["action"])
165 }
166 if result["chat_id"] != "oc_bot" {
167 t.Errorf("chat_id = %v", result["chat_id"])
168 }
169 if result["operator_id"] != "ou_operator" {
170 t.Errorf("operator_id = %v", result["operator_id"])
171 }
172 if result["external"] != false {
173 t.Errorf("external = %v", result["external"])
174 }
175}
176
177func TestImChatBotDeletedProcessor_Compact(t *testing.T) {
178 p := NewImChatBotDeletedProcessor()

Callers

nothing calls this directly

Calls 4

makeRawEventFunction · 0.85
EventTypeMethod · 0.65
TransformMethod · 0.65

Tested by

no test coverage detected