Skip to content

Commit 43ddf93

Browse files
committed
chore(test-helper): setup promise polyfill for browser testing
relates to ReactiveX#998
1 parent 9bd7649 commit 43ddf93

File tree

7 files changed

+17
-10
lines changed

7 files changed

+17
-10
lines changed

spec/Observable-spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ describe('Observable', function () {
3535

3636
it('should reject promise when in error', function (done) {
3737
Observable.throw('bad').forEach(function (x) {
38-
throw 'should not be called';
39-
}).then(function () {
38+
done.fail('should not be called');
39+
}, null, Promise).then(function () {
4040
done.fail('should not complete');
4141
}, function (err) {
4242
expect(err).toBe('bad');

spec/observables/forkJoin-spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* globals describe, it, expect, lowerCaseO, hot, expectObservable */
22
var Rx = require('../../dist/cjs/Rx');
33
var Observable = Rx.Observable;
4+
var Promise = require('promise');
45

56
describe('Observable.forkJoin', function () {
67
it('should join the last values of the provided observables into an array', function () {

spec/observables/from-promise-spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* globals describe, it, expect */
22
var Rx = require('../../dist/cjs/Rx');
33
var Observable = Rx.Observable;
4+
var Promise = require('promise');
45

56
describe('Observable.fromPromise', function () {
67
it('should emit one value from a resolved promise', function (done) {

spec/operators/concatAll-spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* globals describe, it, expect, expectObservable, expectSubscriptions, hot, cold */
22
var Rx = require('../../dist/cjs/Rx');
33
var Observable = Rx.Observable;
4+
var Promise = require('promise');
45

56
describe('Observable.prototype.concatAll()', function () {
67
it('should concat sources from promise', function (done) {

spec/operators/debounce-spec.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* globals describe, it, expect, expectObservable, expectSubscriptions, hot, cold, rxTestScheduler */
22
var Rx = require('../../dist/cjs/Rx');
33
var Observable = Rx.Observable;
4+
var Promise = require('promise');
45

56
describe('Observable.prototype.debounce()', function () {
67
function getTimerSelector(x) {
@@ -357,12 +358,13 @@ describe('Observable.prototype.debounce()', function () {
357358
e1.debounce(function () {
358359
return new Promise(function (resolve) { resolve(42); });
359360
}).subscribe(function (x) {
360-
expect(x).toEqual(expected.shift()); },
361-
function () { throw 'should not be called'; },
362-
function () {
363-
expect(expected.length).toBe(0);
364-
done();
365-
});
361+
expect(x).toEqual(expected.shift());
362+
}, function (err) {
363+
done.fail('should not be called');
364+
}, function () {
365+
expect(expected.length).toBe(0);
366+
done();
367+
});
366368
});
367369

368370
it('should raises error when promise rejects', function (done) {

spec/operators/mergeAll-spec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
/* globals describe, it, expect, expectObservable, hot, cold */
1+
/* globals describe, it, expect, expectObservable, expectSubscriptions, hot, cold */
22
var Rx = require('../../dist/cjs/Rx');
33
var Observable = Rx.Observable;
4+
var Promise = require('promise');
45

56
describe('Observable.prototype.mergeAll()', function () {
67
it.asDiagram('mergeAll')('should merge a hot observable of cold observables', function () {

spec/operators/throttle-spec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
/* globals describe, it, expect, expectObservable, expectSubscription, hot, cold */
1+
/* globals describe, it, expect, expectObservable, expectSubscriptions, hot, cold */
22
var Rx = require('../../dist/cjs/Rx');
33
var Observable = Rx.Observable;
44
var Scheduler = Rx.Scheduler;
5+
var Promise = require('promise');
56

67
describe('Observable.prototype.throttle()', function () {
78
it.asDiagram('throttle')('should immediately emit the first value in each time window', function () {

0 commit comments

Comments
 (0)