social-platform-donut-backend icon indicating copy to clipboard operation
social-platform-donut-backend copied to clipboard

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

Open vaibhavdaren opened this issue 4 years ago • 0 comments

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

vaibhavdaren avatar Jun 18 '20 13:06 vaibhavdaren