-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsubscription_name_enum_test.go
More file actions
47 lines (41 loc) · 1.64 KB
/
subscription_name_enum_test.go
File metadata and controls
47 lines (41 loc) · 1.64 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
47
package gokick_test
import (
"fmt"
"testing"
"github.com/scorfly/gokick"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestNewSubscriptionNameError(t *testing.T) {
testCases := map[string]string{
"empty": "",
"not supported": "not supported",
}
for name, value := range testCases {
t.Run(name, func(t *testing.T) {
_, err := gokick.NewSubscriptionName(value)
assert.EqualError(t, err, fmt.Sprintf("unknown name: %s", value))
})
}
}
func TestNewSubscriptionNameSuccess(t *testing.T) {
testCases := map[string]gokick.SubscriptionName{
"chat.message.sent": gokick.SubscriptionNameChatMessage,
"channel.followed": gokick.SubscriptionNameChannelFollow,
"channel.subscription.renewal": gokick.SubscriptionNameChannelSubscriptionRenewal,
"channel.subscription.gifts": gokick.SubscriptionNameChannelSubscriptionGifts,
"channel.subscription.new": gokick.SubscriptionNameChannelSubscriptionCreated,
"livestream.status.updated": gokick.SubscriptionNameLivestreamStatusUpdated,
"livestream.metadata.updated": gokick.SubscriptionNameLivestreamMetadataUpdated,
"moderation.banned": gokick.SubscriptionNameModerationBanned,
"kicks.gifted": gokick.SubscriptionNameKicksGifted,
"channel.reward.redemption.updated": gokick.SubscriptionNameChannelRewardRedemptionUpdated,
}
for name, value := range testCases {
t.Run(name, func(t *testing.T) {
subscriptionName, err := gokick.NewSubscriptionName(value.String())
require.NoError(t, err)
assert.Equal(t, subscriptionName, value)
})
}
}