Consider that I have an API end-point http://localhost/add-page-view. When we send a post request with data {url: "google.com"}
it will be sent to a message queue, then later will be inserted to the DB by the queue subscriber
I need to write a test case that will send a post request to this end-point, then check whether "google.com"
has been inserted to DB. Since it's inserted via Message Queue, we aren't sure whether it's inserted or not.
One way is to post data to end-point after 2 seconds check whether it has been inserted
But, that doesn't sound like a good solution
Note: It's an integration test, not a unit test
Aucun commentaire:
Enregistrer un commentaire