-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkarma_bepp_test.go
More file actions
29 lines (25 loc) · 744 Bytes
/
Copy pathkarma_bepp_test.go
File metadata and controls
29 lines (25 loc) · 744 Bytes
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
package main
import "testing"
func TestDecodeKarmaBlockedIgnored(t *testing.T) {
raw := bepp("kr", append(pnTag("Bob"), []byte(" gives you good karma")...))
// Sanity check: unblocked message should be returned.
players = make(map[string]*Player)
if got := decodeBEPP(raw); got == "" {
t.Fatalf("decodeBEPP returned empty for unblocked message")
}
cases := []struct {
name string
p *Player
}{
{"blocked", &Player{Name: "Bob", Blocked: true}},
{"ignored", &Player{Name: "Bob", Ignored: true}},
}
for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
players = map[string]*Player{"Bob": tc.p}
if got := decodeBEPP(raw); got != "" {
t.Fatalf("decodeBEPP returned %q, want empty", got)
}
})
}
}