social-platform-donut-backend
social-platform-donut-backend copied to clipboard
await new Promise((resolve) => setTimeout(() => resolve(), 500))
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