Added unit test for continue in root route error (#768)
* Added unit test for continue in root route error * replaced %v with %q
This commit is contained in:
parent
c9163bd689
commit
a77bfb44d6
|
@ -52,6 +52,7 @@ func Load(s string) (*Config, error) {
|
|||
return nil, errors.New("no route provided in config")
|
||||
}
|
||||
|
||||
// Check if continue in root route.
|
||||
if cfg.Route.Continue {
|
||||
return nil, errors.New("cannot have continue in root route")
|
||||
}
|
||||
|
|
|
@ -37,3 +37,26 @@ route:
|
|||
t.Errorf("\nexpected:\n%v\ngot:\n%v", expected, err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
func TestContinueErrorInRouteRoot(t *testing.T) {
|
||||
in := `
|
||||
route:
|
||||
receiver: team-X-mails
|
||||
continue: true
|
||||
|
||||
receivers:
|
||||
- name: 'team-X-mails'
|
||||
`
|
||||
|
||||
_, err := Load(in)
|
||||
|
||||
expected := "cannot have continue in root route"
|
||||
|
||||
if err == nil {
|
||||
t.Fatalf("no error returned, expeceted:\n%q", expected)
|
||||
}
|
||||
if err.Error() != expected {
|
||||
t.Errorf("\nexpected:\n%q\ngot:\n%q", expected, err.Error())
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue