mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
31 lines
589 B
JavaScript
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();
|
|
});
|
|
});
|
|
|