mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
29 lines
567 B
JavaScript
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();
|
|
});
|
|
});
|
|
|