Rank log: inactive ranks (Guardian) count as promotions to and from, demotion when lost; Guardian is staff
This commit is contained in:
parent
611b79cdba
commit
0af93d1eab
7 changed files with 76 additions and 24 deletions
25
internal/web/public_test.go
Normal file
25
internal/web/public_test.go
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package web
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestInactiveKind(t *testing.T) {
|
||||
guardian := &rankView{Name: "#rank/guardian", Inactive: true}
|
||||
mod := &rankView{Name: "#rank/mod"}
|
||||
owner := &rankView{Name: "#rank/owner"}
|
||||
for _, c := range []struct {
|
||||
kind string
|
||||
old, new *rankView
|
||||
want string
|
||||
}{
|
||||
{"demoted", owner, guardian, "promoted"},
|
||||
{"promoted", guardian, mod, "promoted"},
|
||||
{"removed", guardian, nil, "demoted"},
|
||||
{"added", nil, guardian, "added"},
|
||||
{"demoted", owner, mod, "demoted"},
|
||||
{"removed", mod, nil, "removed"},
|
||||
} {
|
||||
if got := inactiveKind(c.kind, c.old, c.new); got != c.want {
|
||||
t.Errorf("%v -> %v: got %s, want %s", c.old, c.new, got, c.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue