forked from andersfylling/disgord
-
Notifications
You must be signed in to change notification settings - Fork 0
/
message_test.go
53 lines (44 loc) · 1.18 KB
/
message_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
// +build !integration
package disgord
import (
"testing"
)
func TestMessage_updateInternals(t *testing.T) {
m := &Message{}
m.updateInternals()
if m.SpoilerTagContent {
t.Error("expects spoiler tag for content to be false. Got true")
}
if m.SpoilerTagAllAttachments {
t.Error("expects spoiler tag for attachments to be false. Got true")
}
m.Content = "||||"
m.updateInternals()
if !m.SpoilerTagContent {
t.Error("expects spoiler tag for content to be true. Got false")
}
m.Content = "|.||"
m.updateInternals()
if m.SpoilerTagContent {
t.Error("expects spoiler tag for content to be false. Got true")
}
m.Content = "|| testing ||"
m.updateInternals()
if !m.SpoilerTagContent {
t.Error("expects spoiler tag for content to be true. Got false")
}
m.Attachments = append(m.Attachments, &Attachment{
Filename: AttachmentSpoilerPrefix,
})
m.updateInternals()
if !m.SpoilerTagAllAttachments {
t.Error("expects spoiler tag for attachments to be true. Got false")
}
m.Attachments = append(m.Attachments, &Attachment{
Filename: "random",
})
m.updateInternals()
if m.SpoilerTagAllAttachments {
t.Error("expects spoiler tag for attachments to be false. Got true")
}
}