Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(take): test case for error notification after limit is reached #6394

Merged
merged 1 commit into from May 10, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 19 additions & 2 deletions spec/operators/take-spec.ts
@@ -1,7 +1,7 @@
/** @prettier */
import { expect } from 'chai';
import { take, mergeMap } from 'rxjs/operators';
import { of, Observable, Subject } from 'rxjs';
import { merge, Observable, of, Subject } from 'rxjs';
import { mergeMap, take, tap } from 'rxjs/operators';
import { TestScheduler } from 'rxjs/testing';
import { observableMatcher } from '../helpers/observableMatcher';

Expand Down Expand Up @@ -217,4 +217,21 @@ describe('take', () => {
expectSubscriptions(e1.subscriptions).toBe(e1subs);
});
});

it.skip('should unsubscribe from the source when it reaches the limit before a recursive synchronous upstream error is notified', () => {
testScheduler.run(({ cold, expectObservable, expectSubscriptions }) => {
const subject = new Subject();
const e1 = cold(' (a|)');
const e1subs = ' (^!)';
const expected = '(a|)';

const result = merge(e1, subject).pipe(
take(1),
tap(() => subject.error('error'))
);

expectObservable(result).toBe(expected);
expectSubscriptions(e1.subscriptions).toBe(e1subs);
});
});
});