fix(notifier): don't panic on unconfigured notifier (#869)

This commit is contained in:
nils måsén 2021-04-18 18:11:46 +02:00 committed by GitHub
parent 3b60afe553
commit b644ec6829
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 0 deletions

View file

@ -23,6 +23,22 @@ func TestActions(t *testing.T) {
}
var _ = Describe("notifications", func() {
Describe("the notifier", func() {
When("only empty notifier types are provided", func() {
command := cmd.NewRootCommand()
flags.RegisterNotificationFlags(command)
err := command.ParseFlags([]string{
"--notifications",
"shoutrrr",
})
Expect(err).NotTo(HaveOccurred())
notif := notifications.NewNotifier(command)
Expect(notif.String()).To(Equal("none"))
})
})
Describe("the slack notifier", func() {
builderFn := notifications.NewSlackNotifier