2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-08 17:22:34 +03:00
Files
axios/test/specs/helpers/isAxiosError.spec.js
T
DigitalBrainJS 7f1236652a Refactored AxiosError to a constructor;
Refactored `Cancel` to a constructor, a subclass of the `AxiosError`;
Expose CanceledError class;
Refactored axios error codes;
Added `toFlatObject` util;
2021-10-14 19:15:16 +03:00

20 lines
707 B
JavaScript

var AxiosError = require('../../../lib/core/AxiosError');
var isAxiosError = require('../../../lib/helpers/isAxiosError');
describe('helpers::isAxiosError', function() {
it('should return true if the error is created by core::createError', function() {
expect(isAxiosError(new AxiosError('Boom!', null, { foo: 'bar' })))
.toBe(true);
});
it('should return true if the error is enhanced by core::enhanceError', function() {
expect(isAxiosError(AxiosError.from(new Error('Boom!'), null, { foo: 'bar' })))
.toBe(true);
});
it('should return false if the error is a normal Error instance', function() {
expect(isAxiosError(new Error('Boom!')))
.toBe(false);
});
});