cloudcmd/common/callbackify.spec.js
2019-05-17 20:10:32 +03:00

31 lines
589 B
JavaScript

'use strict';
const test = require('supertape');
const callbackify = require('./callbackify');
test('cloudcmd: common: callbackify: error', (t) => {
const promise = async () => {
throw Error('hello');
};
const fn = callbackify(promise);
fn((e) => {
t.equal(e.message, 'hello');
t.end();
});
});
test('cloudcmd: common: callbackify', (t) => {
const promise = async () => {
return 'hi';
};
const fn = callbackify(promise);
fn((e, data) => {
t.equal(data, 'hi');
t.end();
});
});