Add support for headers, method, body and json path with arrays

This commit is contained in:
TwinProduction
2020-04-14 19:20:00 -04:00
parent 88d0d8a724
commit fe3e60dbd4
14 changed files with 531 additions and 234 deletions

37
core/service_test.go Normal file
View File

@ -0,0 +1,37 @@
package core
import (
"testing"
)
func TestIntegrationEvaluateConditions(t *testing.T) {
condition := Condition("[STATUS] == 200")
service := Service{
Name: "TwiNNatioN",
Url: "https://twinnation.org/health",
Conditions: []*Condition{&condition},
}
result := service.EvaluateConditions()
if !result.ConditionResults[0].Success {
t.Errorf("Condition '%s' should have been a success", condition)
}
if !result.Success {
t.Error("Because all conditions passed, this should have been a success")
}
}
func TestIntegrationEvaluateConditionsWithFailure(t *testing.T) {
condition := Condition("[STATUS] == 500")
service := Service{
Name: "TwiNNatioN",
Url: "https://twinnation.org/health",
Conditions: []*Condition{&condition},
}
result := service.EvaluateConditions()
if result.ConditionResults[0].Success {
t.Errorf("Condition '%s' should have been a failure", condition)
}
if result.Success {
t.Error("Because one of the conditions failed, success should have been false")
}
}