2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-11 18:02:32 +03:00

Fixing reject not being called on xhr network errors.

Fixes #204
This commit is contained in:
Philip Roberts
2016-01-22 16:39:41 +00:00
parent a473744e05
commit 252876c2c0
2 changed files with 33 additions and 0 deletions
+23
View File
@@ -54,6 +54,29 @@ describe('requests', function () {
}, 0);
});
it('should reject on network errors', function (done) {
// disable jasmine.Ajax since we're hitting a non-existant server anyway
jasmine.Ajax.uninstall();
var resolveSpy = jasmine.createSpy('resolve');
var rejectSpy = jasmine.createSpy('reject');
var finish = function () {
expect(resolveSpy).not.toHaveBeenCalled();
expect(rejectSpy).toHaveBeenCalledWith(jasmine.any(Error));
expect(rejectSpy.calls.argsFor(0)[0].message).toEqual('Network Error');
done();
};
axios({
url: 'http://thisisnotaserver'
})
.then(resolveSpy, rejectSpy)
.then(finish, finish);
});
it('should make cross domian http request', function (done) {
var request, response;