forked from andersfylling/disgord
-
Notifications
You must be signed in to change notification settings - Fork 0
/
struct_channel_test.go
53 lines (44 loc) · 1.24 KB
/
struct_channel_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
package disgord
import "testing"
func TestChannel_InterfaceImplementations(t *testing.T) {
var c interface{} = &Channel{}
t.Run("DeepCopier", func(t *testing.T) {
if _, ok := c.(DeepCopier); !ok {
t.Error("Channel does not implement DeepCopier")
}
test := NewChannel()
test.Icon = "sdljfdsjf"
test.PermissionOverwrites = append(test.PermissionOverwrites, PermissionOverwrite{
Type: "first",
})
test.PermissionOverwrites = append(test.PermissionOverwrites, PermissionOverwrite{
Type: "second",
})
copy := test.DeepCopy().(*Channel)
test.Icon = "sfkjdsf"
if copy.Icon != "sdljfdsjf" {
t.Error("deep copy failed")
}
test.PermissionOverwrites = append(test.PermissionOverwrites, PermissionOverwrite{
Type: "third",
})
if len(copy.PermissionOverwrites) != 2 {
t.Error("deep copy failed")
}
})
t.Run("Copier", func(t *testing.T) {
if _, ok := c.(Copier); !ok {
t.Error("Channel does not implement Copier")
}
})
t.Run("discordSaver", func(t *testing.T) {
if _, ok := c.(discordSaver); !ok {
t.Error("Channel does not implement discordSaver")
}
})
t.Run("discordDeleter", func(t *testing.T) {
if _, ok := c.(discordDeleter); !ok {
t.Error("Channel does not implement discordDeleter")
}
})
}