Skip to content

Commit

Permalink
fix(anzen): promise all tests (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
sviridoff authored Nov 28, 2023
1 parent 5522b52 commit 338bbf2
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions packages/anzen/src/__tests__/anzen_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,21 +120,13 @@ describe('Result', () => {
]);
assert.equal(result.isSuccess, true);
assert.equal(result.isFailure, false);
assert.deepEqual(result.getValue(), [1, 2]);
assert.deepEqual(result.getValue(), [1, 2, 'A']);
});

it('when promises are resolved with failure, should return expected value', async () => {
async function promise1() {
const random = Math.random();
if (random < 0.5) {
return Result.success(1);
}
return Result.failure('a');
}
const promise2 = Promise.resolve(Result.failure(2));
const promise1 = Promise.resolve(Result.failure(2));
const result = await Result.promiseAll([
promise1(),
promise2,
promise1,
]);
assert.equal(result.isSuccess, false);
assert.equal(result.isFailure, true);
Expand Down

0 comments on commit 338bbf2

Please sign in to comment.