wechat-bot/markdown_test.go
2022-07-21 23:10:41 +08:00

24 lines
513 B
Go

package wxworkbot
import (
"encoding/json"
"github.com/stretchr/testify/assert"
"testing"
)
func TestMarkdownMessage(t *testing.T) {
jsonString := `
{
"msgtype": "markdown",
"markdown": {
"content": "<font color=\"warning\">233</font>"
}
}`
var markdownMsg markdownMessage
err := json.Unmarshal([]byte(jsonString), &markdownMsg)
assert.Nil(t, err)
assert.Equal(t, markdownMsg.MsgType, "markdown")
assert.Equal(t, markdownMsg.Markdown.Content,
"<font color=\"warning\">233</font>")
}