fix(dingtalk): parse rich text image messages
This commit is contained in:
@@ -41,6 +41,28 @@ func TestParseCallbackMessagePicture(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseCallbackMessageRichTextWithPictureAndText(t *testing.T) {
|
||||
msg := &callbackMessage{
|
||||
MsgID: "msg-richtext-1",
|
||||
Msgtype: "richText",
|
||||
Content: []byte(`{"richText":[{"text":" 请描述这张图片 "},{"type":"picture","downloadCode":"rich-webhook-code"}]}`),
|
||||
}
|
||||
|
||||
got := parseCallbackMessage(msg)
|
||||
if got.MessageType != im.MessageTypeImage {
|
||||
t.Fatalf("MessageType = %q, want image", got.MessageType)
|
||||
}
|
||||
if got.Content != "请描述这张图片" {
|
||||
t.Fatalf("Content = %q", got.Content)
|
||||
}
|
||||
if got.FileKey != "rich-webhook-code" {
|
||||
t.Fatalf("FileKey = %q", got.FileKey)
|
||||
}
|
||||
if got.FileName != "msg-richtext-1.png" {
|
||||
t.Fatalf("FileName = %q", got.FileName)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAdapterDownloadFileUsesMessageFilesAPI(t *testing.T) {
|
||||
var sawToken bool
|
||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
Reference in New Issue
Block a user