Add basic tests for providers

This commit is contained in:
TwinProduction
2020-10-21 21:18:06 -04:00
parent ce6cc9e18d
commit aa671bc72d
4 changed files with 53 additions and 3 deletions

View File

@ -1,6 +1,7 @@
package custom
import (
"github.com/TwinProduction/gatus/core"
"io/ioutil"
"testing"
)
@ -57,3 +58,14 @@ func TestAlertProvider_buildRequestWhenTriggered(t *testing.T) {
t.Error("expected body to be", ExpectedBody, "was", string(body))
}
}
func TestAlertProvider_ToCustomAlertProvider(t *testing.T) {
provider := AlertProvider{Url: "http://example.com"}
customAlertProvider := provider.ToCustomAlertProvider(&core.Service{}, &core.Alert{}, &core.Result{}, true)
if customAlertProvider == nil {
t.Error("customAlertProvider shouldn't have been nil")
}
if customAlertProvider != customAlertProvider {
t.Error("customAlertProvider should've been equal to customAlertProvider")
}
}