Skip to content

Commit

Permalink
test(merge): expand test coverage for merge operator
Browse files Browse the repository at this point in the history
  • Loading branch information
kwonoj authored and benlesh committed Nov 10, 2015
1 parent 6011dfb commit 46ca1d7
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions spec/observables/merge-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ describe('Observable.merge(...observables)', function () {
expectSubscriptions(e2.subscriptions).toBe(e2subs);
});

it('should return itself when try to merge single observable', function () {
var e1 = Observable.of('a');
var result = Observable.merge(e1);

expect(e1).toBe(result);
});

it('should merge hot and hot', function () {
var e1 = hot('---a---^-b-----c----|');
var e1subs = '^ !';
Expand Down Expand Up @@ -197,12 +204,28 @@ describe('Observable.merge(...observables)', function () {
});
});

describe('Observable.merge(number, ...observables)', function () {
describe('Observable.merge(...observables, Scheduler, number)', function () {
it('should handle concurrency limits', function () {
var e1 = cold('---a---b---c---|');
var e2 = cold('-d---e---f--|');
var e3 = cold( '---x---y---z---|');
var expected = '-d-a-e-b-f-c---x---y---z---|';
expectObservable(Observable.merge(e1, e2, e3, 2)).toBe(expected);
});
});

it('should handle scheduler', function () {
var e1 = Observable.of('a');
var e2 = Observable.of('b').delay(20, rxTestScheduler);
var expected = 'a-(b|)';

expectObservable(Observable.merge(e1, e2, rxTestScheduler)).toBe(expected);
});

it('should handle scheduler with concurrency limits', function () {
var e1 = cold('---a---b---c---|');
var e2 = cold('-d---e---f--|');
var e3 = cold( '---x---y---z---|');
var expected = '-d-a-e-b-f-c---x---y---z---|';
expectObservable(Observable.merge(e1, e2, e3, 2, rxTestScheduler)).toBe(expected);
});
});

0 comments on commit 46ca1d7

Please sign in to comment.