diff --git a/spec/asynciterable/catcherror-spec.ts b/spec/asynciterable/catcherror-spec.ts index 44907dbb..d1d5ab3f 100644 --- a/spec/asynciterable/catcherror-spec.ts +++ b/spec/asynciterable/catcherror-spec.ts @@ -1,3 +1,4 @@ +import { jest } from '@jest/globals'; import { skip } from 'ix/asynciterable/operators.js'; import { hasNext } from '../asynciterablehelpers.js'; import { @@ -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); diff --git a/spec/iterable/catcherror-spec.ts b/spec/iterable/catcherror-spec.ts index 245c8efb..658716fb 100644 --- a/spec/iterable/catcherror-spec.ts +++ b/spec/iterable/catcherror-spec.ts @@ -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);