Skip to content

Commit

Permalink
fix:
Browse files Browse the repository at this point in the history
  • Loading branch information
jeengbe committed Jul 23, 2024
1 parent 8572fb7 commit 2eae459
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 5 additions & 2 deletions spec/asynciterable/catcherror-spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { jest } from '@jest/globals';
import { skip } from 'ix/asynciterable/operators.js';
import { hasNext } from '../asynciterablehelpers.js';
import {
Expand Down Expand Up @@ -42,11 +43,13 @@ test('AsyncIterable#catchError still throws', async () => {
});

test('AsyncIterable#catchError calls return() on source iterator when stopped early', async () => {
const xs1 = range(0, 2);
const e1 = new Error();
const er1 = throwError(e1);

const xs2 = range(2, 2)[Symbol.asyncIterator]();
const returnSpy = jest.spyOn(xs2, 'return');

const res = catchError(xs1, from(xs2)).pipe(skip(2));
const res = catchError(concat(range(0, 2), er1), from(xs2)).pipe(skip(2));

await first(res);

Expand Down
6 changes: 4 additions & 2 deletions spec/iterable/catcherror-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,13 @@ test('Iterable.catchError still throws', () => {
});

test('Iterable.catchError calls return() on source iterator when stopped early', () => {
const xs1 = range(0, 2);
const e1 = new Error();
const er1 = throwError(e1);

const xs2 = range(2, 2)[Symbol.iterator]();
const returnSpy = jest.spyOn(xs2, 'return');

const res = catchError(xs1, from(xs2)).pipe(skip(2));
const res = catchError(concat(range(0, 2), er1), from(xs2)).pipe(skip(2));

first(res);

Expand Down

0 comments on commit 2eae459

Please sign in to comment.