BaseCase/testdouble-chai

calledWith format

Opened this issue · 2 comments

Thanks for creating such a handy little library!

The output of calledWith with seems to be a bit broken when using the contains matcher. Here's what I get when using testdouble.verify:

testdouble.verify(requestMock(testdouble.matchers.contains({
  headers: { "Authorization": "Bearer ACCESS_TOKEN" },
  method: "GET"
})));
Wanted:
    - called with `(contains({headers: {Authorization: "Bearer ACCESS_TOKEN"}, method: "GET"}))`.

  But was actually called:
    - called with `({
  method: "POST",
  url: "http://graph:8989/api/query",
  headers: {Authorization: "Bearer ACCESS_TOKEN"},
  json: {"@class": ".Query"}
})`.

And this is the output when running with testdouble-chai:

expect(requestMock).to.have.been.calledWith(testdouble.matchers.contains({
  headers: { "Authorization": "Bearer ACCESS_TOKEN" },
  method: "GET"
}));
       [
         {
      -    "headers": {
      -      "Authorization": "Bearer ACCESS_TOKEN"
      -    }
      -    "json": {
      -      "@class": ".Query"
      -    }
      -    "method": "POST"
      -    "url": "http://graph:8989/api/query"
      +    "__matches": [Function]
      +    "__name": "contains({headers: {Authorization: \"Bearer ACCESS_TOKEN\"}, method: \"GET\"})"
         }
       ]

Whoops! Thanks for the report, @LandonSchropp. I'll try to dig into that soon and figure out what's up :)

Thanks for the quick reply!