mirror of
https://github.com/tenrok/axios.git
synced 2026-06-20 20:00:40 +03:00
Adding failing tests that verify errors contain the request
This commit is contained in:
@@ -48,13 +48,17 @@ describe('core::settle', function() {
|
||||
});
|
||||
|
||||
it('should reject promise if validateStatus returns false', function() {
|
||||
var req = {
|
||||
path: '/foo'
|
||||
};
|
||||
var response = {
|
||||
status: 500,
|
||||
config: {
|
||||
validateStatus: function() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
},
|
||||
request: req
|
||||
};
|
||||
settle(resolve, reject, response);
|
||||
expect(resolve).not.toHaveBeenCalled();
|
||||
@@ -63,6 +67,7 @@ describe('core::settle', function() {
|
||||
expect(reason instanceof Error).toBe(true);
|
||||
expect(reason.message).toBe('Request failed with status code 500');
|
||||
expect(reason.config).toBe(response.config);
|
||||
expect(reason.request).toBe(req);
|
||||
expect(reason.response).toBe(response);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user