Skip to content

Commit

Permalink
use promise instead async/await in the test/utils.js
Browse files Browse the repository at this point in the history
  • Loading branch information
dimapaloskin committed Mar 11, 2017
1 parent 880fde6 commit 0a56cd0
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@ exports.createSimple = fn => {
});
};

exports.createChain = async config => {
const chained = chain(config);
const server = micro(chained);
const listen = Promise.promisify(server.listen, { context: server });
const p = await getPort();
await listen(p);
return p;
exports.createChain = config => {
return new Promise((resolve, reject) => {
const chained = chain(config);
const server = micro(chained);
const listen = Promise.promisify(server.listen, { context: server });
getPort().then(p => {
listen(p)
.then(() => resolve(p))
.catch(reject);
}).catch(reject);
});
};

0 comments on commit 0a56cd0

Please sign in to comment.