refactor: DisableWebPagePreview

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu
2020-10-03 09:20:17 +08:00
parent 737043aa8d
commit dc17cf7288
3 changed files with 33 additions and 7 deletions
+24
View File
@@ -124,6 +124,30 @@ func TestSendMessage(t *testing.T) {
assert.NotNil(t, err)
}
func TestDisableWebPagePreviewMessage(t *testing.T) {
plugin := Plugin{
Config: Config{
Token: os.Getenv("TELEGRAM_TOKEN"),
To: []string{os.Getenv("TELEGRAM_TO")},
DisableWebPagePreview: true,
Debug: false,
},
}
err := plugin.Exec()
assert.NotNil(t, err)
plugin.Config.Format = formatMarkdown
plugin.Config.Message = "DisableWebPagePreview https://www.google.com.tw"
err = plugin.Exec()
assert.NotNil(t, err)
// disable message
plugin.Config.DisableWebPagePreview = false
err = plugin.Exec()
assert.NotNil(t, err)
}
func TestBotError(t *testing.T) {
plugin := Plugin{
Repo: Repo{