pact-foundation / pact-reference

Reference implementations for the pact specifications
https://pact.io
MIT License
93 stars 46 forks source link

fix: Fix can't match array of numbers #463

Closed tienvx closed 2 weeks ago

tienvx commented 2 months ago

Before the fix:

2024-09-06T04:24:10.924510Z DEBUG tokio-runtime-worker pact_matching: --> Mismatches: [BodyMismatch { path: "$.$.age", expected: Some(b"[\"27\"]"), actual: Some(b"[\"41\"]"), mismatch: "Unable to match [\"27\"] using Number" }]

After the fix:

2024-09-06T04:18:29.737113Z DEBUG tokio-runtime-worker pact_matching::matchingrules: Comparing '["27"]' to '["41"]' using Number -> Ok(())
2024-09-06T04:18:29.737122Z DEBUG tokio-runtime-worker pact_matching::matchingrules: Comparing list item 0 with value 'Some("41")' to '"27"'
2024-09-06T04:18:29.737147Z DEBUG tokio-runtime-worker pact_matching::matchers: String -> String: comparing '27' to '41' ==> true cascaded=true matcher=Number