100% coverage in Guardian, coverage tests in Services

This commit is contained in:
andronache
2021-02-02 17:30:03 +02:00
committed by Dan Christian Bogos
parent 2fb018ef79
commit c9b2c64b9c
4 changed files with 256 additions and 4 deletions

View File

@@ -310,13 +310,12 @@ func TestGuardianGuardUnguardIDs(t *testing.T) {
}
}
func testHandler() (interface{}, error) {
return nil, utils.ErrNotFound
}
func TestGuardianGuardUnguardIDsCase2(t *testing.T) {
//for coverage purposes
lkIDs := []string{"test1", "test2", "test3"}
_, err := Guardian.Guard(testHandler, 10*time.Millisecond, lkIDs...)
_, err := Guardian.Guard(func() (interface{}, error) {
return nil, utils.ErrNotFound
}, 10*time.Millisecond, lkIDs...)
if err == nil || err != utils.ErrNotFound {
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", utils.ErrNotFound, err)
}