File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,12 @@ func (n *Notifier) String() string {
5555 sb .WriteString (", " )
5656 }
5757 }
58+
59+ if sb .Len () < 2 {
60+ // No notification services are configured, return early as the separator strip is not applicable
61+ return "none"
62+ }
63+
5864 names := sb .String ()
5965
6066 // remove the last separator
Original file line number Diff line number Diff line change @@ -23,6 +23,22 @@ func TestActions(t *testing.T) {
2323}
2424
2525var _ = Describe ("notifications" , func () {
26+ Describe ("the notifier" , func () {
27+ When ("only empty notifier types are provided" , func () {
28+
29+ command := cmd .NewRootCommand ()
30+ flags .RegisterNotificationFlags (command )
31+
32+ err := command .ParseFlags ([]string {
33+ "--notifications" ,
34+ "shoutrrr" ,
35+ })
36+ Expect (err ).NotTo (HaveOccurred ())
37+ notif := notifications .NewNotifier (command )
38+
39+ Expect (notif .String ()).To (Equal ("none" ))
40+ })
41+ })
2642 Describe ("the slack notifier" , func () {
2743 builderFn := notifications .NewSlackNotifier
2844
You can’t perform that action at this time.
0 commit comments