chai
chai copied to clipboard
There seems only one expect.to.eventually.have.property can exist in the test case.
it('can process the JSON payload from the provider', () => {
const response = fetchProviderData(submissionDate)
return expect(response).to.eventually.have.property('count', 0.1)
The code(in Consumer.spec.js and ConsumerPact.spec.js) does not verify the 'data' property. Is it left out for simplicity? Or is it because we can only have one return expect...?
If I change the code to
expect(response).to.eventually.have.property('date2', 'we') // no return return expect(response).to.eventually.have.property('count', 0.1)
This code will always pass no matter what the 'date2' or 'date3' If the code is
return expect(response).to.eventually.have.property('date2', 'we') // with return The code will fail.
So al the expect without a return in the repo are invalid tests! I run the test with npm run and gets the behavior I see above.