test: Add case for making sure pat() works inside a JSON array

This commit is contained in:
TwiN 2022-11-16 18:27:28 -05:00
parent cdbf5902c7
commit 502e159dca

View File

@ -309,6 +309,13 @@ func TestCondition_evaluate(t *testing.T) {
ExpectedSuccess: false,
ExpectedOutput: "pat(*<div id=\"user\">john.doe</div>*) == [BODY] (<!DOCTYPE html><html lang...(truncated))",
},
{
Name: "body-pattern-in-array",
Condition: Condition("[BODY].data == pat(*Whatever*)"),
Result: &Result{body: []byte("{\"data\": [\"hello\", \"world\", \"Whatever\"]}")},
ExpectedSuccess: true,
ExpectedOutput: "[BODY].data == pat(*Whatever*)",
},
{
Name: "ip-pattern",
Condition: Condition("[IP] == pat(10.*)"),