Alan Boshier
03/12/2022, 3:24 PMarrayContaining
- there are other properties using that matcher which are working fine. Is this a known issue, or is there something in the logs I should be looking for to give me a clue?Matt (pactflow.io / pact-js / pact-go)
03/12/2022, 9:22 PMAlan Boshier
03/12/2022, 11:08 PMMatt (pactflow.io / pact-js / pact-go)
03/13/2022, 2:27 AMAlan Boshier
03/16/2022, 10:12 AMquery badQuery($id: ID!) {
foo(id: $id) {
bar {
results {
__typename
}
}
}
}
This is the expectation:
foo: {
bar: arrayContaining(
{
results: arrayContaining({
__typename: equal('Result')
})
}
)
}
This is the debug level log:
[2022-03-16T10:07:04Z DEBUG pact_ffi::mock_server::bodies] Path = $
[2022-03-16T10:07:04Z DEBUG pact_ffi::mock_server::bodies] Configuring a normal object
[2022-03-16T10:07:04Z DEBUG pact_ffi::mock_server::bodies] Path = $.variables
[2022-03-16T10:07:04Z DEBUG pact_ffi::mock_server::bodies] Configuring a normal object
[2022-03-16T10:07:04Z DEBUG pact_ffi::mock_server::bodies] Path = $.variables.id
[2022-03-16T10:07:04Z DEBUG pact_ffi::mock_server::bodies] detected pact:matcher:type, will configure a matcher
[2022-03-16T10:07:04Z DEBUG pact_ffi::mock_server::bodies] Path = $
[2022-03-16T10:07:04Z DEBUG pact_ffi::mock_server::bodies] Configuring a normal object
[2022-03-16T10:07:04Z DEBUG pact_ffi::mock_server::bodies] Path = $.data
[2022-03-16T10:07:04Z DEBUG pact_ffi::mock_server::bodies] Configuring a normal object
[2022-03-16T10:07:04Z DEBUG pact_ffi::mock_server::bodies] Path = $.data.foo
[2022-03-16T10:07:04Z DEBUG pact_ffi::mock_server::bodies] Configuring a normal object
[2022-03-16T10:07:04Z DEBUG pact_ffi::mock_server::bodies] Path = $.data.foo.bar
[2022-03-16T10:07:04Z DEBUG pact_ffi::mock_server::bodies] detected pact:matcher:type, will configure a matcher
[2022-03-16T10:07:04Z DEBUG pact_ffi::mock_server::bodies] Path = $
[2022-03-16T10:07:04Z DEBUG pact_ffi::mock_server::bodies] Configuring a normal object
[2022-03-16T10:07:04Z DEBUG pact_ffi::mock_server::bodies] Path = $.results
[2022-03-16T10:07:04Z DEBUG pact_ffi::mock_server::bodies] detected pact:matcher:type, will configure a matcher
[2022-03-16T10:07:04Z DEBUG pact_ffi::mock_server::bodies] Path = $
[2022-03-16T10:07:04Z DEBUG pact_ffi::mock_server::bodies] Configuring a normal object
[2022-03-16T10:07:04Z DEBUG pact_ffi::mock_server::bodies] Path = $.__typename
[2022-03-16T10:07:04Z DEBUG pact_ffi::mock_server::bodies] detected pact:matcher:type, will configure a matcher
[2022-03-16T10:07:04Z DEBUG pact_ffi::mock_server::bodies] Path = $.results
[2022-03-16T10:07:04Z DEBUG pact_ffi::mock_server::bodies] Path = $.results[*]
[2022-03-16T10:07:04Z DEBUG pact_ffi::mock_server::bodies] Configuring a normal object
[2022-03-16T10:07:04Z DEBUG pact_ffi::mock_server::bodies] Path = $.results[*].__typename
[2022-03-16T10:07:04Z DEBUG pact_ffi::mock_server::bodies] detected pact:matcher:type, will configure a matcher
[2022-03-16T10:07:04Z DEBUG pact_ffi::mock_server::bodies] Skipping the matching rule (skip_matchers == true)
[2022-03-16T10:07:04Z DEBUG pact_ffi::mock_server::bodies] Path = $.data.foo.bar
[2022-03-16T10:07:04Z DEBUG pact_ffi::mock_server::bodies] Path = $.data.foo.bar[*]
[2022-03-16T10:07:04Z DEBUG pact_ffi::mock_server::bodies] Configuring a normal object
[2022-03-16T10:07:04Z DEBUG pact_ffi::mock_server::bodies] Path = $.data.foo.bar[*].results
[2022-03-16T10:07:04Z DEBUG pact_ffi::mock_server::bodies] detected pact:matcher:type, will configure a matcher
[2022-03-16T10:07:04Z DEBUG pact_ffi::mock_server::bodies] Skipping the matching rule (skip_matchers == true)
[2022-03-16T10:07:04Z DEBUG pact_plugin_driver::catalogue_manager] Updated catalogue entries:
core/interaction/http
core/interaction/https
[2022-03-16T10:07:04Z DEBUG pact_plugin_driver::catalogue_manager] Updated catalogue entries:
core/content-generator/binary
core/content-generator/json
core/content-matcher/json
core/content-matcher/multipart-form-data
core/content-matcher/text
core/content-matcher/xml
[2022-03-16T10:07:04Z DEBUG pact_plugin_driver::catalogue_manager] Updated catalogue entries:
core/matcher/v1-equality
core/matcher/v2-max-type
core/matcher/v2-min-type
core/matcher/v2-minmax-type
core/matcher/v2-regex
core/matcher/v2-type
core/matcher/v3-content-type
core/matcher/v3-date
core/matcher/v3-datetime
core/matcher/v3-decimal-type
core/matcher/v3-includes
core/matcher/v3-integer-type
core/matcher/v3-null
core/matcher/v3-number-type
core/matcher/v3-time
core/matcher/v4-array-contains
core/matcher/v4-equals-ignore-order
core/matcher/v4-max-equals-ignore-order
core/matcher/v4-min-equals-ignore-order
core/matcher/v4-minmax-equals-ignore-order
core/matcher/v4-not-empty
core/matcher/v4-semver
[2022-03-16T10:07:04Z DEBUG pact_mock_server::mock_server] Started mock server on 127.0.0.1:65384
[2022-03-16T10:07:04Z DEBUG hyper::proto::h1::io] parsed 7 headers
[2022-03-16T10:07:04Z DEBUG hyper::proto::h1::conn] incoming body is content-length (178 bytes)
[2022-03-16T10:07:04Z DEBUG hyper::proto::h1::conn] incoming body completed
[2022-03-16T10:07:04Z DEBUG pact_mock_server::hyper_server] Creating pact request from hyper request
[2022-03-16T10:07:04Z DEBUG pact_mock_server::hyper_server] Extracting query from uri /graphql
[2022-03-16T10:07:04Z INFO pact_mock_server::hyper_server] Received request HTTP Request ( method: POST, path: /graphql, query: None, headers: Some({"host": ["127.0.0.1:65384"], "content-type": ["application/json"], "content-length": ["178"], "user-agent": ["node-fetch/1.0 (+<https://github.com/bitinn/node-fetch>)"], "accept": ["*/*"], "connection": ["close"], "accept-encoding": ["gzip", "deflate"]}), body: Present(178 bytes, application/json) )
[2022-03-16T10:07:04Z DEBUG pact_mock_server::hyper_server] body: '{"operationName":"badQuery","variables":{"id":"1"},"query":"query badQuery($id: ID!) {\n foo(id: $id) {\n bar {\n results {\n __typename\n }\n }\n }\n}"}'
[2022-03-16T10:07:04Z INFO pact_matching] comparing to expected HTTP Request ( method: POST, path: /graphql, query: None, headers: Some({"Content-Type": ["application/json"]}), body: Present(178 bytes, application/json) )
[2022-03-16T10:07:04Z DEBUG pact_matching] body: '{"operationName":"badQuery","query":"query badQuery($id: ID!) {\n foo(id: $id) {\n bar {\n results {\n __typename\n }\n }\n }\n}","variables":{"id":"1"}}'
[2022-03-16T10:07:04Z DEBUG pact_matching] matching_rules: MatchingRules { rules: {BODY: MatchingRuleCategory { name: BODY, rules: {DocPath { path_tokens: [Root, Field("variables"), Field("id")], expr: "$.variables.id" }: RuleList { rules: [Type], rule_logic: And, cascaded: false }} }, PATH: MatchingRuleCategory { name: PATH, rules: {} }} }
[2022-03-16T10:07:04Z DEBUG pact_matching] generators: Generators { categories: {} }
[2022-03-16T10:07:04Z DEBUG pact_matching::matchers] String -> String: comparing '/graphql' to '/graphql' using Equality (false)
[2022-03-16T10:07:04Z DEBUG pact_matching] expected content type = 'application/json', actual content type = 'application/json'
[2022-03-16T10:07:04Z DEBUG pact_matching] content type header matcher = 'RuleList { rules: [], rule_logic: And, cascaded: false }'
[2022-03-16T10:07:04Z DEBUG pact_plugin_driver::catalogue_manager] Looking for a content matcher for application/json
[2022-03-16T10:07:04Z DEBUG pact_matching] No content matcher defined for content type 'application/json', using core matcher implementation
[2022-03-16T10:07:04Z DEBUG pact_matching] Using body matcher for content type 'application/json'
[2022-03-16T10:07:04Z DEBUG pact_matching::json] compare: Comparing path $
[2022-03-16T10:07:04Z DEBUG pact_matching::json] compare_maps: Comparing maps at $: {"operationName": String("badQuery"), "query": String("query badQuery($id: ID!) {\n foo(id: $id) {\n bar {\n results {\n __typename\n }\n }\n }\n}"), "variables": Object({"id": String("1")})} -> {"operationName": String("badQuery"), "query": String("query badQuery($id: ID!) {\n foo(id: $id) {\n bar {\n results {\n __typename\n }\n }\n }\n}"), "variables": Object({"id": String("1")})}
[2022-03-16T10:07:04Z DEBUG pact_matching::json] compare: Comparing path $.operationName
[2022-03-16T10:07:04Z DEBUG pact_matching::json] JSON -> JSON: Comparing '"badQuery"' to '"badQuery"' using Equality -> Ok(())
[2022-03-16T10:07:04Z DEBUG pact_matching::json] compare_values: Comparing 'String("badQuery")' to 'String("badQuery")' at path '$.operationName' -> Ok(())
[2022-03-16T10:07:04Z DEBUG pact_matching::json] compare: Comparing path $.query
[2022-03-16T10:07:04Z DEBUG pact_matching::json] JSON -> JSON: Comparing '"query badQuery($id: ID!) {\n foo(id: $id) {\n bar {\n results {\n __typename\n }\n }\n }\n}"' to '"query badQuery($id: ID!) {\n foo(id: $id) {\n bar {\n results {\n __typename\n }\n }\n }\n}"' using Equality -> Ok(())
[2022-03-16T10:07:04Z DEBUG pact_matching::json] compare_values: Comparing 'String("query badQuery($id: ID!) {\n foo(id: $id) {\n bar {\n results {\n __typename\n }\n }\n }\n}")' to 'String("query badQuery($id: ID!) {\n foo(id: $id) {\n bar {\n results {\n __typename\n }\n }\n }\n}")' at path '$.query' -> Ok(())
[2022-03-16T10:07:04Z DEBUG pact_matching::json] compare: Comparing path $.variables
[2022-03-16T10:07:04Z DEBUG pact_matching::json] compare_maps: Comparing maps at $.variables: {"id": String("1")} -> {"id": String("1")}
[2022-03-16T10:07:04Z DEBUG pact_matching::json] compare: Comparing path $.variables.id
[2022-03-16T10:07:04Z DEBUG pact_matching::json] compare_values: Calling match_values for path $.variables.id
[2022-03-16T10:07:04Z DEBUG pact_matching::json] JSON -> JSON: Comparing '"1"' to '"1"' using Type -> Ok(())
[2022-03-16T10:07:04Z DEBUG pact_matching::json] compare_values: Comparing 'String("1")' to 'String("1")' at path '$.variables.id' -> Ok(())
[2022-03-16T10:07:04Z DEBUG pact_matching] --> Mismatches: []
[2022-03-16T10:07:04Z DEBUG pact_mock_server::hyper_server] Test context = {"mockServer": Object({"href": String("<http://127.0.0.1:65384>"), "port": Number(65384)})}
[2022-03-16T10:07:04Z INFO pact_mock_server::hyper_server] Request matched, sending response HTTP Response ( status: 200, headers: Some({"Content-Type": ["application/json"]}), body: Present(43 bytes, application/json) )
[2022-03-16T10:07:04Z DEBUG pact_mock_server::hyper_server] body: '{"data":{"foo":{"bar":[{"results":null}]}}}'
[2022-03-16T10:07:04Z DEBUG hyper::proto::h1::io] flushed 355 bytes
[2022-03-16T10:07:04Z INFO pact_mock_server::mock_server] Writing pact out to 'C:\Dev\git_repos\apps\case_notes_on_the_go\pacts\ena-app-apigateway.json'
[2022-03-16T10:07:04Z DEBUG pact_models::pact] Merging pact with file "C:\\Dev\\git_repos\\apps\\case_notes_on_the_go\\pacts\\ena-app-apigateway.json"
[2022-03-16T10:07:04Z WARN pact_models::pact] Note: Existing pact is an older specification version (V3), and will be upgraded
[2022-03-16T10:07:04Z DEBUG pact_mock_server::server_manager] Shutting down mock server with port 65384
[2022-03-16T10:07:04Z DEBUG pact_mock_server::server_manager] Shutting down mock server with port 65384 - MockServerMetrics { requests: 1 }
[2022-03-16T10:07:04Z DEBUG pact_mock_server::mock_server] Mock server cf98a3b4-4aa0-4836-8bcb-9f144d34a04b shutdown - MockServerMetrics { requests: 1 }
[2022-03-16T10:07:04Z DEBUG hyper::server::shutdown] signal received, starting graceful shutdown
Error: expect(received).resolves.toEqual(expected) // deep equality
- Expected - 5
+ Received + 1
Object {
"foo": Object {
"bar": Array [
Object {
- "results": Array [
- Object {
- "__typename": "Result",
- },
- ],
+ "results": null,
},
],
},
}
Matt (pactflow.io / pact-js / pact-go)
03/16/2022, 10:24 AM{"data":{"foo":{"bar":[{"results":null}]}}}
despite the nested arrayContaining
Alan Boshier
03/16/2022, 10:48 AMMatt (pactflow.io / pact-js / pact-go)
03/16/2022, 11:16 AM