BREAKING CHANGE(remove util dependency and promisify functionality): update

This commit is contained in:
2019-03-26 12:02:01 +01:00
parent e42061047a
commit 93f426cce0
2 changed files with 7 additions and 18 deletions

View File

@ -1,10 +1,6 @@
import { expect, tap } from 'tapbundle';
import * as q from '../ts/index';
let myCallback = (someValue1: string, cb?) => {
cb(null, someValue1);
};
tap.test('should return a Deferred for .defer()', async () => {
let myDeferred = q.defer();
let expectPromise = expect(myDeferred.promise).to.eventually.be.fulfilled;
@ -20,16 +16,10 @@ tap.test('should let types flow through the Promise', async () => {
return expectPromise;
});
tap.test('should promisify a callback', async () => {
let myPromisified = q.promisify(myCallback);
let expectPromise = expect(myPromisified('hi')).to.eventually.equal('hi');
return await expectPromise;
});
tap.test('should map callbacks', async () => {
let inputArray = ['hi', 'awesome'];
let myPromisified = q.promisify(myCallback);
let expectPromise = expect(q.map(inputArray, myPromisified)).to.eventually.deep.equal(inputArray);
const myPromisified = async (myInput) => { return myInput };
const expectPromise = expect(q.map(inputArray, myPromisified)).to.eventually.deep.equal(inputArray);
return expectPromise;
});