cloudcmd/common/callbackify.spec.js
2020-12-22 13:29:19 +02:00

29 lines
567 B
JavaScript

import test from 'supertape';
import callbackify from './callbackify.js';
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();
});
});