Skip to content

Commit

Permalink
test: fix race condition in test_connection.js
Browse files Browse the repository at this point in the history
  • Loading branch information
gabegorelick committed Jun 12, 2019
1 parent 3e082c0 commit 2f9b580
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions test/test_connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,15 @@ describe('connection', () => {

const testQueue = utils.buildQueue('external connections', opts);

return testQueue
.isReady()
return new Promise(resolve => {
if (subscriber.status === 'ready') {
return resolve();
}
subscriber.once('ready', resolve);
})
.then(() => {
return testQueue.isReady();
})
.then(() => {
return testQueue.add({ foo: 'bar' });
})
Expand Down

0 comments on commit 2f9b580

Please sign in to comment.