-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheval_test.go
42 lines (34 loc) · 1.05 KB
/
eval_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
package main
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestEvaluate_fail_roles(t *testing.T) {
assert.ErrorContains(
t,
Evaluate("askywalk", "council", "jedi", []string{"master", "padawan"}, true),
"askywalk does not have roles in council: master, padawan; found jedi",
)
}
func TestEvaluate_fail_role(t *testing.T) {
assert.ErrorContains(
t,
Evaluate("askywalk", "council", "jedi", []string{"master"}, false),
"askywalk does not have role in council: master; found jedi",
)
}
func TestEvaluate_succeed_noError(t *testing.T) {
assert.NoError(t, Evaluate("askywalk", "council", "jedi", []string{}, false))
}
func ExampleEvaluate_succeed_noRoles_friendly() {
Evaluate("askywalk", "council", "jedi", []string{}, true)
// Output: askywalk has jedi role in council.
}
func ExampleEvaluate_succeed_noRoles_unfriendly() {
Evaluate("askywalk", "council", "jedi", []string{}, false)
// Output: jedi
}
func ExampleEvaluate_succeed_roles_friendly() {
Evaluate("askywalk", "council", "jedi", []string{"jedi"}, false)
// Output: jedi
}