-
Notifications
You must be signed in to change notification settings - Fork 0
/
slack_test.go
57 lines (50 loc) · 1.3 KB
/
slack_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
49
50
51
52
53
54
55
56
57
package slack_test
import (
"testing"
"github.com/pcpratheesh/slack-connector"
"github.com/stretchr/testify/require"
)
func TestSlack(t *testing.T) {
client := slack.New(
slack.WithToken("token-id"),
slack.WithChannelID("channel-id"),
slack.WithSlackAPIInit(),
)
_ = client
_, _, err := slack.Client().PushMessage("pushed first")
require.Nil(t, err)
}
func TestSlackWithNewChannel(t *testing.T) {
client := slack.New(
slack.WithToken("token-id"),
slack.WithChannelID("channel-id"),
slack.WithSlackAPIInit(),
)
_ = client
_, _, err := slack.Client().Channel("channel-id").PushMessage("pushed second")
require.Nil(t, err)
}
func TestSlackForChannel(t *testing.T) {
client := slack.New(
slack.WithToken("token-id"),
slack.WithChannelID("channel-id"),
slack.WithSlackAPIInit(),
)
_ = client
_, _, err := slack.Client().PushMessage("pushed third")
require.Nil(t, err)
}
func TestSlackWithMultipleChannels(t *testing.T) {
client := slack.New(
slack.WithToken("token-id"),
slack.WithChannelID("channel-id"),
slack.WithSlackAPIInit(),
)
_ = client
_, _, err := slack.Client().PushMessage("pushed A")
require.Nil(t, err)
_, _, err = slack.Client().Channel("channel-id").PushMessage("pushed B")
require.Nil(t, err)
_, _, err = slack.Client().PushMessage("pushed C")
require.Nil(t, err)
}