fix(core): update
This commit is contained in:
parent
984c2bc9d8
commit
63dd46ed49
16
test/test.ts
16
test/test.ts
@ -1,27 +1,27 @@
|
|||||||
import { expect, tap } from '@pushrocks/tapbundle';
|
import { expect, tap } from '@pushrocks/tapbundle';
|
||||||
import * as q from '../ts/index';
|
import * as smartpromise from '../ts/index';
|
||||||
|
|
||||||
tap.test('should return a Deferred for .defer()', async () => {
|
tap.test('should return a Deferred for .defer()', async () => {
|
||||||
let myDeferred = q.defer();
|
const myDeferred = smartpromise.defer();
|
||||||
let expectPromise = expect(myDeferred.promise).to.eventually.be.fulfilled;
|
const expectPromise = expect(myDeferred.promise).to.eventually.be.fulfilled;
|
||||||
myDeferred.resolve();
|
myDeferred.resolve();
|
||||||
return expectPromise;
|
return expectPromise;
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('should let types flow through the Promise', async () => {
|
tap.test('should let types flow through the Promise', async () => {
|
||||||
let myString = 'someString';
|
const myString = 'someString';
|
||||||
let myDeferred = q.defer<string>();
|
const myDeferred = smartpromise.defer<string>();
|
||||||
let expectPromise = expect(myDeferred.promise).to.eventually.equal('someString');
|
const expectPromise = expect(myDeferred.promise).to.eventually.equal('someString');
|
||||||
myDeferred.resolve(myString);
|
myDeferred.resolve(myString);
|
||||||
return expectPromise;
|
return expectPromise;
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('should map callbacks', async () => {
|
tap.test('should map callbacks', async () => {
|
||||||
let inputArray = ['hi', 'awesome'];
|
const inputArray = ['hi', 'awesome'];
|
||||||
const myPromisified = async myInput => {
|
const myPromisified = async myInput => {
|
||||||
return myInput;
|
return myInput;
|
||||||
};
|
};
|
||||||
const expectPromise = expect(q.map(inputArray, myPromisified)).to.eventually.deep.equal(
|
const expectPromise = expect(smartpromise.map(inputArray, myPromisified)).to.eventually.deep.equal(
|
||||||
inputArray
|
inputArray
|
||||||
);
|
);
|
||||||
return expectPromise;
|
return expectPromise;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user