diff --git a/test/ng/httpSpec.js b/test/ng/httpSpec.js index 14ac8433..e996c6df 100644 --- a/test/ng/httpSpec.js +++ b/test/ng/httpSpec.js @@ -1427,6 +1427,20 @@ describe('$http', function() { $httpBackend.verifyNoOutstandingExpectation(); $httpBackend.verifyNoOutstandingRequest(); })); + + + it('should reject promise when timeout promise resolves', inject(function($timeout) { + var onFulfilled = jasmine.createSpy('onFulfilled'); + var onRejected = jasmine.createSpy('onRejected'); + $httpBackend.expect('GET', '/some').respond(200); + + $http({method: 'GET', url: '/some', timeout: $timeout(noop, 10)}).then(onFulfilled, onRejected); + + $timeout.flush(100); + + expect(onFulfilled).not.toHaveBeenCalled(); + expect(onRejected).toHaveBeenCalledOnce(); + })); });