You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
telebot/media_test.go

45 lines
889 B
Go

package telebot
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestAlbumSetCaption(t *testing.T) {
tests := []struct {
name string
media Inputtable
}{
{
name: "photo",
media: &Photo{Caption: "wrong_caption"},
},
{
name: "animation",
media: &Animation{Caption: "wrong_caption"},
},
{
name: "video",
media: &Video{Caption: "wrong_caption"},
},
{
name: "audio",
media: &Audio{Caption: "wrong_caption"},
},
{
name: "document",
media: &Document{Caption: "wrong_caption"},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
var a Album
a = append(a, tt.media)
a = append(a, &Photo{Caption: "random_caption"})
a.SetCaption("correct_caption")
assert.Equal(t, "correct_caption", a[0].InputMedia().Caption)
assert.Equal(t, "random_caption", a[1].InputMedia().Caption)
})
}
}