Skip to content

Commit

Permalink
refactor(test): update marble to not emit after completion
Browse files Browse the repository at this point in the history
  • Loading branch information
kwonoj authored and benlesh committed Feb 9, 2016
1 parent 595f4ef commit 64bf6b1
Show file tree
Hide file tree
Showing 14 changed files with 40 additions and 36 deletions.
12 changes: 6 additions & 6 deletions spec/observables/zip-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,20 +179,20 @@ describe('Observable.zip', function () {
});

it('should work with non-empty observable and empty iterable', function () {
var a = hot('---^----#--|');
var asubs = '^ ! ';
var a = hot('---^----#');
var asubs = '^ !';
var b = [];
var expected = '-----# ';
var expected = '-----#';

expectObservable(Observable.zip(a,b)).toBe(expected);
expectSubscriptions(a.subscriptions).toBe(asubs);
});

it('should work with observable which raises error and non-empty iterable', function () {
var a = hot('---^----#--|');
var asubs = '^ ! ';
var a = hot('---^----#');
var asubs = '^ !';
var b = [1];
var expected = '-----# ';
var expected = '-----#';

expectObservable(Observable.zip(a,b)).toBe(expected);
expectSubscriptions(a.subscriptions).toBe(asubs);
Expand Down
2 changes: 1 addition & 1 deletion spec/operators/catch-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ describe('Observable.prototype.catch()', function () {
});

it('should catch error and replace it with a hot Observable', function () {
var e1 = hot('--a--b--#----| ');
var e1 = hot('--a--b--# ');
var e1subs = '^ ! ';
var e2 = hot('1-2-3-4-5-6-7-8-9-|');
var e2subs = ' ^ !';
Expand Down
2 changes: 1 addition & 1 deletion spec/operators/concatAll-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ describe('Observable.prototype.concatAll()', function () {
y: cold( 'a-b---------|'),
z: cold( 'c-d-e-f-|'),
};
var e1 = hot('--y---------z---#-------------|', values);
var e1 = hot('--y---------z---# ', values);
var expected = '--a-b---------c-#';

expectObservable(e1.concatAll()).toBe(expected);
Expand Down
8 changes: 4 additions & 4 deletions spec/operators/map-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ describe('Observable.prototype.map()', function () {
});

it('should map with index until completed', function () {
var a = hot('-5-^-4--3---2----1--|--8--|--#');
var a = hot('-5-^-4--3---2----1--|');
var asubs = '^ !';
var expected = '--a--b---c----d--|';
var values = {a: 5, b: 14, c: 23, d: 32};
Expand All @@ -155,7 +155,7 @@ describe('Observable.prototype.map()', function () {
});

it('should map with index until an error occurs', function () {
var a = hot('-5-^-4--3---2----1--#--8--|', undefined, 'too bad');
var a = hot('-5-^-4--3---2----1--#', undefined, 'too bad');
var asubs = '^ !';
var expected = '--a--b---c----d--#';
var values = {a: 5, b: 14, c: 23, d: 32};
Expand All @@ -173,7 +173,7 @@ describe('Observable.prototype.map()', function () {
});

it('should map using a custom thisArg', function () {
var a = hot('-5-^-4--3---2----1--|--8--|--#');
var a = hot('-5-^-4--3---2----1--|');
var asubs = '^ !';
var expected = '--a--b---c----d--|';
var values = {a: 5, b: 14, c: 23, d: 32};
Expand All @@ -195,7 +195,7 @@ describe('Observable.prototype.map()', function () {
});

it('should map twice', function () {
var a = hot('-0----1-^-2---3--4-5--6--7-8-|--9-#-|');
var a = hot('-0----1-^-2---3--4-5--6--7-8-|');
var asubs = '^ !';
var expected = '--a---b--c-d--e--f-g-|';
var values = {a: 2, b: 3, c: 4, d: 5, e: 6, f: 7, g: 8};
Expand Down
2 changes: 1 addition & 1 deletion spec/operators/mergeAll-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ describe('Observable.prototype.mergeAll()', function () {
var ysubs = ' ^ ! ';
var z = cold( 'c-d-e-f-| ');
var zsubs = ' ^ ! ';
var e1 = hot('--y---------z---#-------------|', { y: y, z: z });
var e1 = hot('--y---------z---# ', { y: y, z: z });
var e1subs = '^ ! ';
var expected = '--a-b-------c-d-# ';

Expand Down
4 changes: 2 additions & 2 deletions spec/operators/multicast-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ describe('Observable.prototype.multicast()', function () {
source.connect();
});

it('should not throw `cannot subscribe to a disposed subject` when used in ' +
it('should not throw ObjectUnsubscribedError when used in ' +
'a switchMap', function (done) {
var source = Observable.of(1, 2, 3)
.multicast(function () { return new Subject(); })
Expand Down Expand Up @@ -548,7 +548,7 @@ describe('Observable.prototype.multicast()', function () {
source.connect();
});

it('should not throw `cannot subscribe to a disposed subject` when used in ' +
it('should not throw ObjectUnsubscribedError when used in ' +
'a switchMap', function (done) {
var source = Observable.of(1, 2, 3)
.multicast(new Subject())
Expand Down
8 changes: 6 additions & 2 deletions spec/operators/skipUntil-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,14 @@ describe('Observable.prototype.skipUntil()', function () {
var e1 = hot( '--a--b--c--d--e--|');
var e1subs = ['^ !',
'^ !']; // for the explicit subscribe some lines below
var skip = hot( '-------------x--|');
var skip = new Rx.Subject();
var expected = '-';

e1.subscribe(function () {
e1.subscribe(function (x) {
if (x === 'd' && !skip.isUnsubscribed) {
skip.next('x');
}

skip.unsubscribe();
});

Expand Down
2 changes: 1 addition & 1 deletion spec/operators/takeUntil-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('Observable.prototype.takeUntil()', function () {
it('should take values and raises error when notifier raises error', function () {
var e1 = hot('--a--b--c--d--e--f--g--|');
var e1subs = '^ ! ';
var e2 = hot('-------------#--| ');
var e2 = hot('-------------# ');
var e2subs = '^ ! ';
var expected = '--a--b--c--d-# ';

Expand Down
2 changes: 1 addition & 1 deletion spec/operators/window-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ describe('Observable.prototype.window', function () {
rxTestScheduler.schedule(function () {
expect(function () {
window.subscribe();
}).toThrowError('Cannot subscribe to a disposed Subject.');
}).toThrow(new Rx.ObjectUnsubscribedError());
}, late);
});

Expand Down
2 changes: 1 addition & 1 deletion spec/operators/windowCount-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ describe('Observable.prototype.windowCount', function () {
rxTestScheduler.schedule(function () {
expect(function () {
window.subscribe();
}).toThrowError('Cannot subscribe to a disposed Subject.');
}).toThrow(new Rx.ObjectUnsubscribedError());
}, late);
});

Expand Down
6 changes: 3 additions & 3 deletions spec/operators/windowToggle-spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* globals describe, it, expect, hot, cold, expectObservable, expectSubscriptions */
/* globals describe, it, expect, hot, cold, expectObservable, expectSubscriptions, rxTestScheduler */
var Rx = require('../../dist/cjs/Rx.KitchenSink');
var Observable = Rx.Observable;

Expand Down Expand Up @@ -214,7 +214,7 @@ describe('Observable.prototype.windowToggle', function () {
rxTestScheduler.schedule(function () {
expect(function () {
window.subscribe();
}).toThrowError('Cannot subscribe to a disposed Subject.');
}).toThrow(new Rx.ObjectUnsubscribedError());
}, late);
});

Expand Down Expand Up @@ -284,7 +284,7 @@ describe('Observable.prototype.windowToggle', function () {
});

it('should handle errors', function () {
var e1 = hot('--a--^---b---c---d---e--#f---g---h------|');
var e1 = hot('--a--^---b---c---d---e--# ');
var e1subs = '^ ! ';
var e2 = cold('--x-----------y--------z---| ');
var e2subs = '^ ! ';
Expand Down
2 changes: 1 addition & 1 deletion spec/operators/windowWhen-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ describe('Observable.prototype.windowWhen', function () {
rxTestScheduler.schedule(function () {
expect(function () {
window.subscribe();
}).toThrowError('Cannot subscribe to a disposed Subject.');
}).toThrow(new Rx.ObjectUnsubscribedError());
}, late);
});

Expand Down
12 changes: 6 additions & 6 deletions spec/operators/zip-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,20 +178,20 @@ describe('zip', function () {
});

it('should work with non-empty observable and empty iterable', function () {
var a = hot('---^----#--|');
var asubs = '^ ! ';
var a = hot('---^----#');
var asubs = '^ !';
var b = [];
var expected = '-----# ';
var expected = '-----#';

expectObservable(a.zip(b)).toBe(expected);
expectSubscriptions(a.subscriptions).toBe(asubs);
});

it('should work with observable which raises error and non-empty iterable', function () {
var a = hot('---^----#--|');
var asubs = '^ ! ';
var a = hot('---^----#');
var asubs = '^ !';
var b = [1];
var expected = '-----# ';
var expected = '-----#';

expectObservable(a.zip(b)).toBe(expected);
expectSubscriptions(a.subscriptions).toBe(asubs);
Expand Down
12 changes: 6 additions & 6 deletions spec/operators/zipAll-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,20 +189,20 @@ describe('Observable.prototype.zipAll', function () {
});

it('should work with non-empty observable and empty iterable', function () {
var a = hot('---^----#--|');
var asubs = '^ ! ';
var a = hot('---^----#');
var asubs = '^ !';
var b = [];
var expected = '-----# ';
var expected = '-----#';

expectObservable(Observable.of(a,b).zipAll()).toBe(expected);
expectSubscriptions(a.subscriptions).toBe(asubs);
});

it('should work with observable which raises error and non-empty iterable', function () {
var a = hot('---^----#--|');
var asubs = '^ ! ';
var a = hot('---^----#');
var asubs = '^ !';
var b = [1];
var expected = '-----# ';
var expected = '-----#';

expectObservable(Observable.of(a,b).zipAll()).toBe(expected);
expectSubscriptions(a.subscriptions).toBe(asubs);
Expand Down

0 comments on commit 64bf6b1

Please sign in to comment.