BREAKING CHANGE(remove util dependency and promisify functionality): update
This commit is contained in:
14
test/test.ts
14
test/test.ts
@ -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;
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user