-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathevent_app_home_test.go
More file actions
46 lines (36 loc) · 1.01 KB
/
event_app_home_test.go
File metadata and controls
46 lines (36 loc) · 1.01 KB
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
package bot
import (
"encoding/json"
"testing"
"time"
goldie "github.com/sebdah/goldie/v2"
"github.com/slack-go/slack"
"github.com/stretchr/testify/require"
"github.com/chat-roulettte/chat-roulette/internal/database/models"
)
func Test_appHomeTemplate(t *testing.T) {
r := require.New(t)
g := goldie.New(t)
nextRound := time.Date(2021, time.January, 4, 12, 0, 0, 0, time.UTC)
data := appHomeTemplate{
BotUserID: "U0123456789",
AppURL: "https://chat-roulette-for-slack.com",
Channels: []models.Channel{
{
ChannelID: "C0123456789",
Inviter: "U0123456789",
Interval: models.Biweekly,
ConnectionMode: models.VirtualConnectionMode,
NextRound: nextRound,
},
},
}
content, err := renderTemplate(appHomeTemplateFilename, data)
r.NoError(err)
g.Assert(t, "app_home.json", []byte(content))
var view slack.HomeTabViewRequest
err = json.Unmarshal([]byte(content), &view)
r.NoError(err)
r.Equal(view.Type, slack.VTHomeTab)
r.Len(view.Blocks.BlockSet, 14)
}