mock-server / mockserver-client-node

MockServer javascript client for browsers, Node.js or any grunt build
http://mock-server.com
Apache License 2.0
72 stars 34 forks source link

`verifyById` is not a function #136

Closed codan84 closed 2 years ago

codan84 commented 2 years ago

Describe the issue When trying to verify an expectation by expectation ID getting an error.

What you are trying to do Trying to verify an expectation by ID.

MockServer version 5.12.0

To Reproduce

npm i -D mockserver-client@5.13.2

In test:

const client = mockServerClient('127.0.0.1', 1080)
const res = await client.mockAnyResponse(//***//)
const expectationId = JSON.parse(res['body'])[0].id

//later:
await client.verifyById({ id: expectationId }, 1)

Furthermore:

console.log(client.verifyById) //=> undefined
  1. How you are running MockServer (i.e maven plugin, docker, etc): docker
  2. Code you used to create expectations: see above
  3. What error you saw: TypeError: client.verifyById is not a function

Expected behaviour Expectation is verified correctly

MockServer Log N/A

codan84 commented 2 years ago

Looking at the code (also tried @5.12.0) the ById functions are never returned:

var _this = {
            openAPIExpectation: openAPIExpectation,
            mockAnyResponse: mockAnyResponse,
            mockWithCallback: mockWithCallback,
            mockSimpleResponse: mockSimpleResponse,
            setDefaultHeaders: setDefaultHeaders,
            verify: verify,
            verifySequence: verifySequence,
            reset: reset,
            clear: clear,
            bind: bind,
            retrieveRecordedRequests: retrieveRecordedRequests,
            retrieveRecordedRequestsAndResponses: retrieveRecordedRequestsAndResponses,
            retrieveActiveExpectations: retrieveActiveExpectations,
            retrieveRecordedExpectations: retrieveRecordedExpectations,
            retrieveLogMessages: retrieveLogMessages
        };
codan84 commented 2 years ago

Ok this has been fixed 2 months ago: https://github.com/mock-server/mockserver-client-node/pull/127 How long before a release?

codan84 commented 2 years ago

I guess this can be used until the release:

npm i -D https://github.com/mock-server/mockserver-client-node
aldex32 commented 2 years ago

@jamesdbloom Can you make a release please?

jamesdbloom commented 2 years ago

The next released in planned in the next few days just a couple more small issues to sort out first