fix(core): update

This commit is contained in:
2023-04-04 20:22:57 +02:00
parent 40642fd6f6
commit 960c23fecd
15 changed files with 4609 additions and 25844 deletions

View File

@@ -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();