Following the The README documentation of an async test against a mockserver and trying to apply that to remote API I'm finding it doesn't run the assertions (doesn't await?).
If I modify that to talk to a remote API like the demo Swagger Petstore API it doesn't await on the expects so it will pass regardless of the expect
it('pet store test', async function({supertest}) {
const req = await
supertest
.request('https://petstore.swagger.io/v2')
.get('/store/inventory')
.set('Accept', 'application/json')
.expect(200) // For example, if I change this to 400 it will still pass
.expect('Content-Type', /json/);
});
If I instead use a non-async pattern it correctly checks the assertions
it('pet store test2', function({supertest}) {
supertest
.request('https://petstore.swagger.io/v2')
.get('/store/inventory/')
.expect(200) // If I change to 400 it will fail as expected
.expect('Content-Type', /json/)
.end(function() {
console.log('done');
});
});
Following the The README documentation of an async test against a mockserver and trying to apply that to remote API I'm finding it doesn't run the assertions (doesn't await?).
Here is the example from the README
If I modify that to talk to a remote API like the demo Swagger Petstore API it doesn't await on the expects so it will pass regardless of the expect
If I instead use a non-async pattern it correctly checks the assertions