vendredi 1 janvier 2021

What is the best practice to test API endpoints that use 3rd party APIs? [closed]

I have the following workflow:

Step 1: The user uploads information using the first endpoint -> the information will be stored in a database

Step 2: The user uploads a document using the second endpoint -> the document will be uploaded to AWS S3

Step 3: The user calls the 3rd endpoint - Both the document uploaded to S3 and the information will be sent to a 3rd party API

My goal is to write tests to make sure everything works fine. Currently, I test all endpoints separately, but do not stub the 3rd party APIs, so for example I upload documents to S3 during the test for Step 2. Is this considered as bad practice?

My tech stack is Typescript, Mocha and Chai.

Aucun commentaire:

Enregistrer un commentaire