When a user visits the homepage of my app, my express backend makes a RESTful http request to an external API, that returns a JSON.
I want to test that my app is making that API call (without actually making it). I'm currently testing in Mocha with Chai, and have been using Sinon and Supertest.
describe('Server path /', () => {
describe('GET', () => {
it('makes a call to API', async () => {
// request is through Supertest, which makes the http request
const response = await request(app)
.get('/')
// not sure how to test expect axios to have made an http request to the external API
});
});
});
I don't care about the response that the server gives, I just want to check that my app is making the call with the correct path and headers (with api keys etc..)
Aucun commentaire:
Enregistrer un commentaire