Giter VIP home page Giter VIP logo

Comments (8)

tarciosaraiva avatar tarciosaraiva commented on September 2, 2024 1

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.

mefellows avatar mefellows commented on September 2, 2024

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.

tarciosaraiva avatar tarciosaraiva commented on September 2, 2024

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.

tarciosaraiva avatar tarciosaraiva commented on September 2, 2024

@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.

tshortt avatar tshortt commented on September 2, 2024

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.

mefellows avatar mefellows commented on September 2, 2024

Marking as enhancement, waiting on pact-foundation/pact-mock_service/issues/54.

from pact-js.

stale avatar stale commented on September 2, 2024

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.

mefellows avatar mefellows commented on September 2, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.