Skip to content

Commit

Permalink
fix($httpBackend): make sure unexpected request fail on verify no out…
Browse files Browse the repository at this point in the history
…standing request
  • Loading branch information
marcin-wosinek committed Aug 6, 2017
1 parent 56ac2a7 commit 912175b
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion test/ngMock/angular-mocksSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2429,7 +2429,7 @@ describe('ngMock', function() {

describe('ngMockE2E', function() {
describe('$httpBackend', function() {
var hb, realHttpBackend, realHttpBackendBrowser, callback;
var hb, realHttpBackend, realHttpBackendBrowser, $http, callback;

beforeEach(function() {
callback = jasmine.createSpy('callback');
Expand All @@ -2442,10 +2442,29 @@ describe('ngMockE2E', function() {
module('ngMockE2E');
inject(function($injector) {
hb = $injector.get('$httpBackend');
$http = $injector.get('$http');
});
});


it('should throw error when unexpected request - without error callback', function() {
expect(function() {
$http.get('/some').then(noop);

hb.verifyNoOutstandingRequest();
}).toThrowError();
});


it('should throw error when unexpected request - with error callback', function() {

This comment has been minimized.

Copy link
@marcin-wosinek

marcin-wosinek Aug 6, 2017

Author Owner
  ngMockE2E
    $httpBackend
      ✗ should throw error when unexpected request - with error callback
        Expected function to throw an Error.
            at Object.<anonymous> (test/ngMock/angular-mocksSpec.js:2464:10)
expect(function() {
$http.get('/some').then(noop, noop);

hb.verifyNoOutstandingRequest();
}).toThrowError();
});


describe('passThrough()', function() {
it('should delegate requests to the real backend when passThrough is invoked', function() {
var eventHandlers = {progress: angular.noop};
Expand Down

0 comments on commit 912175b

Please sign in to comment.