23 lines
566 B
Go
23 lines
566 B
Go
// internal/notify/notify_test.go
|
|
package notify
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
)
|
|
|
|
// nopNotifier must be returned when notify-send is absent, and must never error.
|
|
func TestNopNotifierIsSilentAndSafe(t *testing.T) {
|
|
n := nopNotifier{}
|
|
if err := n.Notify(context.Background(), "title", "body"); err != nil {
|
|
t.Fatalf("nop Notify must return nil, got %v", err)
|
|
}
|
|
}
|
|
|
|
// NewNotifier always returns a usable Notifier (never nil), whatever the host.
|
|
func TestNewNotifierNeverNil(t *testing.T) {
|
|
if NewNotifier() == nil {
|
|
t.Fatal("NewNotifier returned nil")
|
|
}
|
|
}
|