Skip to content

Commit

Permalink
chore(take): test case for error notification after limit is reached (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
backbone87 committed May 10, 2021
1 parent 3253781 commit 9531c08
Showing 1 changed file with 19 additions and 2 deletions.
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);
});
});
});

0 comments on commit 9531c08

Please sign in to comment.