diff --git a/config/config.go b/config/config.go index 84b2d736..aade06ec 100644 --- a/config/config.go +++ b/config/config.go @@ -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") } diff --git a/config/config_test.go b/config/config_test.go index f48a3b67..b12a7099 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -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()) + } + +}