21 lines
407 B
Go
21 lines
407 B
Go
package interfaces
|
|
|
|
import (
|
|
"reflect"
|
|
"testing"
|
|
)
|
|
|
|
func TestAlertService(t *testing.T) {
|
|
svc := AlertService{
|
|
Notifiers: []Notifier{
|
|
EmailNotifier{Address: "ops@example.com"},
|
|
SmsNotifier{Phone: "+48123456789"},
|
|
},
|
|
}
|
|
got := svc.Broadcast("Node down")
|
|
want := []string{"[email] Node down", "[sms] Node down"}
|
|
if !reflect.DeepEqual(got, want) {
|
|
t.Fatalf("got %v, want %v", got, want)
|
|
}
|
|
}
|