mirror of
https://github.com/TwiN/gatus.git
synced 2025-06-25 20:22:42 +02:00
Add tests for core package
This commit is contained in:
parent
ee479be716
commit
1c05871975
23
core/types_test.go
Normal file
23
core/types_test.go
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
package core
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestEvaluateWithIp(t *testing.T) {
|
||||||
|
condition := Condition("$IP == 127.0.0.1")
|
||||||
|
result := &Result{Ip: "127.0.0.1"}
|
||||||
|
condition.Evaluate(result)
|
||||||
|
if result.ConditionResult[0].Success != true {
|
||||||
|
t.Error("Condition '$IP == 127.0.0.1' should have been a success")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestEvaluateWithStatus(t *testing.T) {
|
||||||
|
condition := Condition("$STATUS == 201")
|
||||||
|
result := &Result{HttpStatus: 201}
|
||||||
|
condition.Evaluate(result)
|
||||||
|
if result.ConditionResult[0].Success != true {
|
||||||
|
t.Error("Condition '$STATUS == 201' should have been a success")
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user