2024-03-10 22:30:15 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"html/template"
|
|
|
|
"io"
|
|
|
|
"log"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"git.sr.ht/~michalr/go-satel"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
tgSenderMessageTest1 = satel.BasicEventElement{Type: satel.ArmedPartition, Index: 1, Value: true}
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestTelegramSender_NoChatIdsWontSendAnything(t *testing.T) {
|
|
|
|
a := assert.New(t)
|
|
|
|
tpl := template.Must(template.New("TelegramMessage").Parse(""))
|
2025-01-06 20:38:43 +00:00
|
|
|
mockBot := MockTgBotAPI{}
|
2024-03-10 22:30:15 +00:00
|
|
|
|
|
|
|
tested := TgSender{&mockBot, MockSatelNameGetter{"mockPart"}, log.New(io.Discard, "", 0), []int64{}}
|
|
|
|
tested.Send(GenericMessage{[]satel.BasicEventElement{tgSenderMessageTest1}}, tpl)
|
2025-01-06 20:38:43 +00:00
|
|
|
a.Equal(0, len(mockBot.messages))
|
2024-03-10 22:30:15 +00:00
|
|
|
}
|