Skip to content

Commit

Permalink
Catch http errors to prevent Chrome unhandled rejections from failing…
Browse files Browse the repository at this point in the history
… tests.
  • Loading branch information
erhardos committed Jan 4, 2018
1 parent 83b8de9 commit eda48bd
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions test/unit/interceptors/oauth-interceptor.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ describe('oauthInterceptor', function() {

$httpBackend.expectGET('https://website.com').respond(400, { error: 'invalid_request' });

$http.get('https://website.com');
$http.get('https://website.com')
.catch(() => { });

$httpBackend.flush();

Expand All @@ -77,7 +78,8 @@ describe('oauthInterceptor', function() {

$httpBackend.expectGET('https://website.com').respond(400, { error: 'invalid_request' });

$http.get('https://website.com');
$http.get('https://website.com')
.catch(() => { });

$httpBackend.flush();

Expand All @@ -93,7 +95,8 @@ describe('oauthInterceptor', function() {

$httpBackend.expectGET('https://website.com').respond(400, { error: 'invalid_grant' });

$http.get('https://website.com');
$http.get('https://website.com')
.catch(() => { });

$httpBackend.flush();

Expand All @@ -106,7 +109,8 @@ describe('oauthInterceptor', function() {

$httpBackend.expectGET('https://website.com').respond(400, { error: 'invalid_grant' });

$http.get('https://website.com');
$http.get('https://website.com')
.catch(() => { });

$httpBackend.flush();

Expand All @@ -122,7 +126,8 @@ describe('oauthInterceptor', function() {

$httpBackend.expectGET('https://website.com').respond(401, { error: 'invalid_token' });

$http.get('https://website.com');
$http.get('https://website.com')
.catch(() => { });

$httpBackend.flush();

Expand All @@ -138,7 +143,8 @@ describe('oauthInterceptor', function() {

$httpBackend.expectGET('https://website.com').respond(401, null, { 'www-authenticate': 'Bearer realm="example"' });

$http.get('https://website.com');
$http.get('https://website.com')
.catch(() => { });

$httpBackend.flush();

Expand Down

0 comments on commit eda48bd

Please sign in to comment.