mirror of
https://github.com/TwiN/gatus.git
synced 2024-11-24 17:04:42 +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) {
|
||||||
invalidProvider := AlertProvider{URL: ""}
|
t.Run("invalid-provider", func(t *testing.T) {
|
||||||
if invalidProvider.IsValid() {
|
invalidProvider := AlertProvider{URL: ""}
|
||||||
t.Error("provider shouldn't have been valid")
|
if invalidProvider.IsValid() {
|
||||||
}
|
t.Error("provider shouldn't have been valid")
|
||||||
validProvider := AlertProvider{URL: "https://example.com"}
|
}
|
||||||
if !validProvider.IsValid() {
|
})
|
||||||
t.Error("provider should've been valid")
|
t.Run("valid-provider", func(t *testing.T) {
|
||||||
}
|
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() {
|
||||||
|
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