codeuino / social-platform-donut-backend

Donut API:
http://donut-api-prod.codeuino.org/
GNU General Public License v3.0
24 stars 57 forks source link

await new Promise((resolve) => setTimeout(() => resolve(), 500)) #137

Open vaibhavdaren opened 4 years ago

vaibhavdaren commented 4 years ago

Fix tests

can you explain this await new Promise((resolve) => setTimeout(() => resolve(), 500))

during the shutdown of superset, somewhere the thread is not waiting for an async system operation to finish. Thus, the operation is delegated to the system but the execution is not blocked or does not wait for the async operation to finish. In the meantime, the test case execution finishes, jest is shutting down and complains about an open handle. So this is making the jest to wait for some time to finish the execution and disable the open handle issue, during npm run test

Originally posted by @Rupeshiya in https://github.com/codeuino/social-platform-donut-backend/pull/135#issuecomment-646003222