-
Notifications
You must be signed in to change notification settings - Fork 0
/
telegram_test.go
48 lines (46 loc) · 1.12 KB
/
telegram_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
45
46
47
48
package main
import (
"fmt"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"testing"
)
func TestPrepareMessageBody(t *testing.T) {
title := "some title"
start := "start time"
end := "end time"
tests := []struct {
name string
status EventStatus
expected string
}{
{
name: "newly created event",
status: StatusCreated,
expected: fmt.Sprintf("🗓️ *%s*\n\n*התחלה:* %s\n*סיום:* %s", title, start, end),
},
{
name: "updated event",
status: StatusUpdated,
expected: fmt.Sprintf("️✍🏻 *עדכון: %s*\n\n*התחלה:* %s\n*סיום:* %s", title, start, end),
},
{
name: "cancelled event",
status: StatusCanceled,
expected: fmt.Sprintf("️🆇 *בוטל: %s*\n\n*התחלה:* %s\n*סיום:* %s", title, start, end),
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
event := CalendarEvent{
Title: title,
Start: start,
End: end,
Status: test.status,
}
actual, err := prepareMessageBody(event)
require.NoError(t, err)
assert.Equal(t, test.expected, actual)
})
}
}