Skip to content

Commit

Permalink
Adds promisify test
Browse files Browse the repository at this point in the history
  • Loading branch information
godu committed May 30, 2018
1 parent 366c658 commit e10e5b3
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/bin/helper/test/promisify.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import test from 'ava';
import promisify from '../promisify';

test('should return a fullfilled promise', t => {
const callbackFunction = function(cb) {
cb();
};

return t.notThrows(promisify(callbackFunction)());
});

test('should return a rejected promise', async t => {
const callbackFunction = function(cb) {
cb(new Error());
};

await t.throws(promisify(callbackFunction)());

const throwFunction = function(cb) {
throw new Error('Error');
};

return t.throws(promisify(throwFunction)());
});

0 comments on commit e10e5b3

Please sign in to comment.