fix(core): update
This commit is contained in:
@@ -1,19 +1,18 @@
|
||||
import { expect, tap } from '@pushrocks/tapbundle';
|
||||
import * as smartpromise from '../ts/index';
|
||||
import * as smartpromise from '../ts/index.js';
|
||||
|
||||
tap.test('should return a Deferred for .defer()', async () => {
|
||||
const myDeferred = smartpromise.defer();
|
||||
const expectPromise = expect(myDeferred.promise).to.eventually.be.fulfilled;
|
||||
myDeferred.resolve();
|
||||
return expectPromise;
|
||||
await myDeferred.promise;
|
||||
});
|
||||
|
||||
tap.test('should let types flow through the Promise', async () => {
|
||||
const myString = 'someString';
|
||||
const myDeferred = smartpromise.defer<string>();
|
||||
const expectPromise = expect(myDeferred.promise).to.eventually.equal('someString');
|
||||
myDeferred.resolve(myString);
|
||||
return expectPromise;
|
||||
const result = await myDeferred.promise;
|
||||
expect(result).toEqual('someString');
|
||||
});
|
||||
|
||||
tap.test('should map callbacks', async () => {
|
||||
@@ -21,10 +20,8 @@ tap.test('should map callbacks', async () => {
|
||||
const myPromisified = async (myInput) => {
|
||||
return myInput;
|
||||
};
|
||||
const expectPromise = expect(
|
||||
smartpromise.map(inputArray, myPromisified)
|
||||
).to.eventually.deep.equal(inputArray);
|
||||
return expectPromise;
|
||||
const result = await smartpromise.map(inputArray, myPromisified);
|
||||
expect(result).toEqual(inputArray);
|
||||
});
|
||||
|
||||
tap.start();
|
||||
|
||||
Reference in New Issue
Block a user