Skip to content

Commit

Permalink
Merge pull request #827 from stackus/add-test-for-pr-784
Browse files Browse the repository at this point in the history
Add test for Popup promise rejections (PR #784)
  • Loading branch information
sahat committed May 20, 2016
2 parents d39d530 + 0883408 commit f2aad66
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/oauth2.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,24 @@ describe('SatellizerOauth2', function() {
//this.oauth2.open();
});

it('should propagate promise rejections', inject(function($q, SatellizerPopup) {
var error;
var message = 'Popup Rejected';
var defer = $q.defer();

spyOn(SatellizerPopup, 'pollPopup').and.returnValue(defer.promise);

this.oauth2.open(this.config.providers.github).catch(function (err) {
error = err;
});

defer.reject(message);
this.$timeout.flush();
this.$timeout.verifyNoPendingTasks();

expect(error).toEqual(message);
}));

});

describe('exchangeForToken()', function() {
Expand Down

0 comments on commit f2aad66

Please sign in to comment.