Skip to content

Commit 02857a2

Browse files
committed
fix race condition in tests
1 parent 9e299d7 commit 02857a2

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

tests/integration/JobsResourceTest.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,10 @@ describe('JobsResource', () => {
8989
__dirname + '/../integration/files/input.png'
9090
);
9191

92-
cloudConvert.tasks.upload(uploadTask, stream);
92+
setTimeout(() => {
93+
// for testing, we need to slow down the upload. otherwise we might miss the event because the job finishes too fast
94+
cloudConvert.tasks.upload(uploadTask, stream);
95+
}, 1000);
9396

9497
const event = await new Promise(resolve => {
9598
cloudConvert.jobs.subscribeEvent(job.id, 'finished', resolve);

0 commit comments

Comments
 (0)