Skip to content

chore(test-helper): setup promise polyfill for browser testing #1151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions spec/Observable-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ describe('Observable', function () {

it('should reject promise when in error', function (done) {
Observable.throw('bad').forEach(function (x) {
throw 'should not be called';
}).then(function () {
done.fail('should not be called');
}, null, Promise).then(function () {
done.fail('should not complete');
}, function (err) {
expect(err).toBe('bad');
Expand Down
1 change: 1 addition & 0 deletions spec/observables/forkJoin-spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* globals describe, it, expect, lowerCaseO, hot, expectObservable */
var Rx = require('../../dist/cjs/Rx');
var Observable = Rx.Observable;
var Promise = require('promise');

describe('Observable.forkJoin', function () {
it('should join the last values of the provided observables into an array', function () {
Expand Down
1 change: 1 addition & 0 deletions spec/observables/from-promise-spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* globals describe, it, expect */
var Rx = require('../../dist/cjs/Rx');
var Observable = Rx.Observable;
var Promise = require('promise');

describe('Observable.fromPromise', function () {
it('should emit one value from a resolved promise', function (done) {
Expand Down
1 change: 1 addition & 0 deletions spec/operators/concatAll-spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* globals describe, it, expect, expectObservable, expectSubscriptions, hot, cold */
var Rx = require('../../dist/cjs/Rx');
var Observable = Rx.Observable;
var Promise = require('promise');

describe('Observable.prototype.concatAll()', function () {
it('should concat sources from promise', function (done) {
Expand Down
14 changes: 8 additions & 6 deletions spec/operators/debounce-spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* globals describe, it, expect, expectObservable, expectSubscriptions, hot, cold, rxTestScheduler */
var Rx = require('../../dist/cjs/Rx');
var Observable = Rx.Observable;
var Promise = require('promise');

describe('Observable.prototype.debounce()', function () {
function getTimerSelector(x) {
Expand Down Expand Up @@ -357,12 +358,13 @@ describe('Observable.prototype.debounce()', function () {
e1.debounce(function () {
return new Promise(function (resolve) { resolve(42); });
}).subscribe(function (x) {
expect(x).toEqual(expected.shift()); },
function () { throw 'should not be called'; },
function () {
expect(expected.length).toBe(0);
done();
});
expect(x).toEqual(expected.shift());
}, function (err) {
done.fail('should not be called');
}, function () {
expect(expected.length).toBe(0);
done();
});
});

it('should raises error when promise rejects', function (done) {
Expand Down
3 changes: 2 additions & 1 deletion spec/operators/mergeAll-spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* globals describe, it, expect, expectObservable, hot, cold */
/* globals describe, it, expect, expectObservable, expectSubscriptions, hot, cold */
var Rx = require('../../dist/cjs/Rx');
var Observable = Rx.Observable;
var Promise = require('promise');

describe('Observable.prototype.mergeAll()', function () {
it.asDiagram('mergeAll')('should merge a hot observable of cold observables', function () {
Expand Down
3 changes: 2 additions & 1 deletion spec/operators/throttle-spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/* globals describe, it, expect, expectObservable, expectSubscription, hot, cold */
/* globals describe, it, expect, expectObservable, expectSubscriptions, hot, cold */
var Rx = require('../../dist/cjs/Rx');
var Observable = Rx.Observable;
var Scheduler = Rx.Scheduler;
var Promise = require('promise');

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