Skip to content

Commit

Permalink
test: Add test for eachKey and eachValue matching rules comparation
Browse files Browse the repository at this point in the history
  • Loading branch information
tienvx committed Sep 6, 2024
1 parent 691ddae commit ac0260e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions rust/pact_models/src/matchingrules/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2635,4 +2635,22 @@ mod tests {
}
)
}

#[test]
#[should_panic]
fn each_value_matching_rule_comparation_test() {
assert_eq!(
matchingrules_list!{"body"; "$.array_values" => [MatchingRule::EachValue(MatchingRuleDefinition::new("[\"string value\"]".to_string(), ValueType::Unknown, MatchingRule::Type, None))]},
matchingrules_list!{"body"; "$.array_values" => [MatchingRule::EachValue(MatchingRuleDefinition::new("[\"something else\"]".to_string(), ValueType::Unknown, MatchingRule::Type, None))]}
)
}

#[test]
#[should_panic]
fn each_key_matching_rule_comparation_test() {
assert_eq!(
matchingrules_list!{"body"; "$.array_values" => [MatchingRule::EachKey(MatchingRuleDefinition::new("a_key".to_string(), ValueType::Unknown, MatchingRule::Type, None))]},
matchingrules_list!{"body"; "$.array_values" => [MatchingRule::EachKey(MatchingRuleDefinition::new("another_key".to_string(), ValueType::Unknown, MatchingRule::Type, None))]}
)
}
}

0 comments on commit ac0260e

Please sign in to comment.