mirror of
https://github.com/TwiN/gatus.git
synced 2024-11-25 01:13:40 +01:00
test(alerting): Improve coverage for custom alerting provider
This commit is contained in:
parent
d9f86f1155
commit
46d6d6c733
@ -13,14 +13,24 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestAlertProvider_IsValid(t *testing.T) {
|
func TestAlertProvider_IsValid(t *testing.T) {
|
||||||
|
t.Run("invalid-provider", func(t *testing.T) {
|
||||||
invalidProvider := AlertProvider{URL: ""}
|
invalidProvider := AlertProvider{URL: ""}
|
||||||
if invalidProvider.IsValid() {
|
if invalidProvider.IsValid() {
|
||||||
t.Error("provider shouldn't have been valid")
|
t.Error("provider shouldn't have been valid")
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
t.Run("valid-provider", func(t *testing.T) {
|
||||||
validProvider := AlertProvider{URL: "https://example.com"}
|
validProvider := AlertProvider{URL: "https://example.com"}
|
||||||
|
if validProvider.ClientConfig != nil {
|
||||||
|
t.Error("provider client config should have been nil prior to IsValid() being executed")
|
||||||
|
}
|
||||||
if !validProvider.IsValid() {
|
if !validProvider.IsValid() {
|
||||||
t.Error("provider should've been valid")
|
t.Error("provider should've been valid")
|
||||||
}
|
}
|
||||||
|
if validProvider.ClientConfig == nil {
|
||||||
|
t.Error("provider client config should have been set after IsValid() was executed")
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAlertProvider_Send(t *testing.T) {
|
func TestAlertProvider_Send(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user