You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it('successfully verifies',done=>{returngetMeDogs({ url, port }).then(provider.verify).then(response=>{expect(response.headers['content-type']).toEqual('application/json');expect(response.data).toEqual(EXPECTED_BODY);expect(response.status).toEqual(200);}).then(done,done)})
The done happens before the assertions are run, so these tests don't do anything, so it will always pass. If you refactor to look something like:
it('successfully verifies',done=>{returngetMeDogs({ url, port }).then(provider.verify).then(response=>{expect(response.headers['content-type']).toEqual('application/json');expect(response.data).toEqual(EXPECTED_BODY);expect(response.status).toEqual(200);done();},(error)=>{console.log(error);done();})})
Now the assertions actually run however response is undefined so the tests fail. After some trial and error I found it was this line .then(provider.verify) made response return undefined. I'm not sure what that actually does but if you remove you get some passing tests.
it('successfully verifies',done=>{returngetMeDogs({ url, port }).then(response=>{expect(response.headers['content-type']).toEqual('application/json');expect(response.data).toEqual(EXPECTED_BODY);expect(response.status).toEqual(200);done();},(error)=>{console.log(error);done();})})
The problem with .then(provider.verify) is also true with the mocha test example. So my question is, what is provider.verify doing? Is it needed? If you let me know I can make a PR and fix these examples.
The text was updated successfully, but these errors were encountered:
#If you check the example: https://github.com/pact-foundation/pact-js/blob/master/examples/jest/__tests__/index.spec.js#L70
The done happens before the assertions are run, so these tests don't do anything, so it will always pass. If you refactor to look something like:
Now the assertions actually run however response is undefined so the tests fail. After some trial and error I found it was this line
.then(provider.verify)
made response return undefined. I'm not sure what that actually does but if you remove you get some passing tests.The problem with
.then(provider.verify)
is also true with the mocha test example. So my question is, what isprovider.verify
doing? Is it needed? If you let me know I can make a PR and fix these examples.The text was updated successfully, but these errors were encountered: