Skip to content

Commit 9531c08

Browse files
authored
chore(take): test case for error notification after limit is reached (#6394)
1 parent 3253781 commit 9531c08

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

spec/operators/take-spec.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/** @prettier */
22
import { expect } from 'chai';
3-
import { take, mergeMap } from 'rxjs/operators';
4-
import { of, Observable, Subject } from 'rxjs';
3+
import { merge, Observable, of, Subject } from 'rxjs';
4+
import { mergeMap, take, tap } from 'rxjs/operators';
55
import { TestScheduler } from 'rxjs/testing';
66
import { observableMatcher } from '../helpers/observableMatcher';
77

@@ -217,4 +217,21 @@ describe('take', () => {
217217
expectSubscriptions(e1.subscriptions).toBe(e1subs);
218218
});
219219
});
220+
221+
it.skip('should unsubscribe from the source when it reaches the limit before a recursive synchronous upstream error is notified', () => {
222+
testScheduler.run(({ cold, expectObservable, expectSubscriptions }) => {
223+
const subject = new Subject();
224+
const e1 = cold(' (a|)');
225+
const e1subs = ' (^!)';
226+
const expected = '(a|)';
227+
228+
const result = merge(e1, subject).pipe(
229+
take(1),
230+
tap(() => subject.error('error'))
231+
);
232+
233+
expectObservable(result).toBe(expected);
234+
expectSubscriptions(e1.subscriptions).toBe(e1subs);
235+
});
236+
});
220237
});

0 commit comments

Comments
 (0)