-
Notifications
You must be signed in to change notification settings - Fork 0
/
media_test.go
44 lines (42 loc) · 889 Bytes
/
media_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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)
})
}
}