Skip to content

Commit

Permalink
test(shareReplay): improve test on sync source subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
voliva authored and josepot committed Jun 23, 2020
1 parent 5822ae3 commit 63f70a9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions spec/operators/shareReplay-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as sinon from 'sinon';
import { hot, cold, expectObservable, expectSubscriptions } from '../helpers/marble-testing';
import { shareReplay, mergeMapTo, retry } from 'rxjs/operators';
import { TestScheduler } from 'rxjs/testing';
import { Observable, Operator, Observer, of } from 'rxjs';
import { Observable, Operator, Observer, of, from } from 'rxjs';

declare const rxTestScheduler: TestScheduler;

Expand Down Expand Up @@ -267,7 +267,15 @@ describe('shareReplay operator', () => {
});

it('should not skip values on a sync source', () => {
const a = cold( '(abcd)');
const a = from(['a', 'b', 'c', 'd']);
// We would like for the previous line to read like this:
//
// const a = cold('(abcd|)');
//
// However, that would synchronously emit multiple values at frame 0,
// but it's not synchronous upon-subscription.
// TODO: revisit once https://github.com/ReactiveX/rxjs/issues/5523 is fixed

const x = cold( 'x-------x');
const expected = '(abcd)--d';

Expand Down

0 comments on commit 63f70a9

Please sign in to comment.