Comments (8)
hi @tshortt looks like it might be a bug with the pact mock server. I opened a new issue there, let's see what comes back 👍
from pact-js.
Hi @tshortt, yes that should be possible - uniqueness for a request is calculated as a combination of the attributes in the withRequest
block.
Could you please provide a Gist to some code? It's more than likely a setup problem.
from pact-js.
Following up on @mefellows answer above, @tshortt could you please also provide the log generated by your test? When the mock server runs it creates a log under <project>/logs/mockserver-integration.log
that would contain the interactions setup / received.
from pact-js.
@tshortt I just realised I didn't have any test related to this case so I'm adding one now. Here's the output I got from my mock server log:
I, [2016-09-21T09:03:53.219929 #14094] INFO -- : Registered expected interaction GET /projects?from=today
D, [2016-09-21T09:03:53.221251 #14094] DEBUG -- : {
"description": "a request for projects",
"provider_state": "i have a list of projects",
"request": {
"method": "GET",
"path": "/projects",
"query": {
"from": [
"today"
]
},
"headers": {
"Accept": "application/json"
}
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/json"
},
"body": [
{
"id": 1,
"name": "Project 1",
"due": "2016-02-11T09:46:56.023Z",
"tasks": [
{
"id": 1,
"name": "Do the laundry",
"done": true
},
{
"id": 2,
"name": "Do the dishes",
"done": false
},
{
"id": 3,
"name": "Do the backyard",
"done": false
},
{
"id": 4,
"name": "Do nothing",
"done": false
}
]
}
]
}
}
I, [2016-09-21T09:03:53.234556 #14094] INFO -- : Received request GET /projects?from=today
D, [2016-09-21T09:03:53.235412 #14094] DEBUG -- : {
"path": "/projects",
"query": "from=today",
"method": "get",
"headers": {
"Host": "localhost:9744",
"Accept-Encoding": "gzip, deflate",
"User-Agent": "node-superagent/2.2.0",
"Accept": "application/json",
"Connection": "close",
"Https": "on",
"Version": "HTTP/1.1"
}
}
I, [2016-09-21T09:03:53.236346 #14094] INFO -- : Found matching response for GET /projects?from=today
D, [2016-09-21T09:03:53.237597 #14094] DEBUG -- : {
"status": 200,
"headers": {
"Content-Type": "application/json"
},
"body": [
{
"id": 1,
"name": "Project 1",
"due": "2016-02-11T09:46:56.023Z",
"tasks": [
{
"id": 1,
"name": "Do the laundry",
"done": true
},
{
"id": 2,
"name": "Do the dishes",
"done": false
},
{
"id": 3,
"name": "Do the backyard",
"done": false
},
{
"id": 4,
"name": "Do nothing",
"done": false
}
]
}
]
}
I, [2016-09-21T09:03:53.245853 #14094] INFO -- : Verifying - interactions matched for example ""
I, [2016-09-21T09:03:53.255236 #14094] INFO -- : Writing pact with details {:consumer=>{:name=>"Consumer 1"}, :provider=>{:name=>"Provider 1"}}
I, [2016-09-21T09:03:53.255425 #14094] INFO -- : Writing pact for Provider 1 to /home/nab/workspace/pact-js/pacts/consumer_1-provider_1.json
I, [2016-09-21T09:03:53.264434 #14094] INFO -- : Cleared interactions before example ""
Here's the test added: https://github.com/pact-foundation/pact-js/blob/master/test/dsl/integration.spec.js#L100
from pact-js.
Here's a gist
https://gist.github.com/tshortt/e453cf12ea7c3114f0c166dc9e75bdfa
So lines 34-37, versus lines 77-83
https://gist.github.com/tshortt/e453cf12ea7c3114f0c166dc9e75bdfa#file-gistfile1-js-L34-L37
https://gist.github.com/tshortt/e453cf12ea7c3114f0c166dc9e75bdfa#file-gistfile1-js-L77-L83
mockserver-integration.log output in the gist
from pact-js.
Marking as enhancement, waiting on pact-foundation/pact-mock_service/issues/54.
from pact-js.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
from pact-js.
I've just tested this and your scenario should work as expected. I'm not sure where along the lines this was fixed, but it is :)
from pact-js.
Related Issues (20)
- Improve developer experience around consumer pact testing HOT 2
- RFC: Remove CLI & Standalone API (Pact Standalone Tools - Ruby), and migrate into sister package pact-js-cli enhancement
- RFC: Support Alpine
- RFC: Pact JS V9.x - Update to latest V2 standalone / Include ARM64 Platforms HOT 1
- Because Maths: invalid pact specification version supplied: 5 HOT 8
- V4 Asynchronous Messages
- Bug: Corporate Proxy not supported during verification
- TypeError: ffi.pactffiMessageGivenWithParams is not a function HOT 2
- Support combining matching rules HOT 3
- `eachLike` behaves like `atLeastOneLike` when min is not explicitly set - contrary to documentation HOT 5
- payload changed by pact between consumer test and provider test HOT 6
- Message provider verification error: "Caught panic with error: failed printing to stdout" HOT 8
- CVE check denying [email protected] which is dependent on by pact-foundation/pact HOT 3
- V3 Matchers package missing matchers from V2
- BadSignature error when approaching broker on HTTPS HOT 5
- Vitest - Pact Verifier fails with 3 or more interactions HOT 8
- V4InteractionWithCompleteRequest is unimplemented HOT 9
- Allow using `new ArrayBuffer(0)` in withRequest.body to be honest in the contract tests HOT 1
- MatchersV3.reify doesn't extract payload from MatchersV3.nullValue() HOT 4
- Consumer test using application/x-www-form-urlencoded content type is being serialised as JSON
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pact-js.