what's the best way to functional test an express API call the endpoint and verify expected changes were made and expected actions taken.
eg. a call with value 'yes' to Api sms/entry ( a twilio web hook ) should: - check user status - order and charge ( thru stripe ) - send response thru twilio API what's a good approach to functional test that? note I'm not interested in testing the http response.
initial thoughts - use nock to intercept http calls to twilio and stripe - use supertest to call endpoint and use mongoose to verify new application state after call ( supertest callback )
we already some unit tests, we aiming for a more high level functional test of the API
"Unit tests tell a developer that the code is doing things right; functional tests tell a developer that the code is doing the right things."
Aucun commentaire:
Enregistrer un commentaire