-
Notifications
You must be signed in to change notification settings - Fork 16
/
watcher_test.go
48 lines (41 loc) · 1.06 KB
/
watcher_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
package sarah
import (
"context"
"strings"
"testing"
)
func TestConfigNotFoundError_Error(t *testing.T) {
var botType BotType = "dummy"
id := "id"
err := &ConfigNotFoundError{
BotType: botType,
ID: id,
}
if !strings.Contains(err.Error(), botType.String()) {
t.Errorf("Error string does not contain BotType: %s.", err.Error())
}
if !strings.Contains(err.Error(), id) {
t.Errorf("Error string does not contain ID: %s.", err.Error())
}
}
func TestNullConfigWatcher_Read(t *testing.T) {
w := &nullConfigWatcher{}
err := w.Read(context.TODO(), "dummy", "id", &struct{}{})
if err != nil {
t.Fatalf("Unexpected error is returned: %s.", err.Error())
}
}
func TestNullConfigWatcher_Watch(t *testing.T) {
w := &nullConfigWatcher{}
err := w.Watch(context.TODO(), "dummy", "id", func() {})
if err != nil {
t.Fatalf("Unexpected error is returned: %s.", err.Error())
}
}
func TestNullConfigWatcher_Unwatch(t *testing.T) {
w := &nullConfigWatcher{}
err := w.Unwatch("dummy")
if err != nil {
t.Fatalf("Unexpected error is returned: %s.", err.Error())
}
}