mirror of
https://github.com/tenrok/axios.git
synced 2026-06-17 19:21:29 +03:00
ef3711d1b3
* feat: implement prettier and fix all issues * fix: failing tests * fix: implement feedback from codel, ai etc * chore: dont throw in trim function Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> * fix: incorrect fix --------- Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
22 lines
901 B
JavaScript
22 lines
901 B
JavaScript
import CanceledError from '../../../lib/cancel/CanceledError';
|
|
|
|
describe('Cancel', function () {
|
|
describe('toString', function () {
|
|
it('returns correct result when message is not specified', function () {
|
|
const cancel = new CanceledError();
|
|
expect(cancel.toString()).toBe('CanceledError: canceled');
|
|
});
|
|
|
|
it('returns correct result when message is specified', function () {
|
|
const cancel = new CanceledError('Operation has been canceled.');
|
|
expect(cancel.toString()).toBe('CanceledError: Operation has been canceled.');
|
|
});
|
|
});
|
|
it('should be a native error as checked by the NodeJS `isNativeError` function', function () {
|
|
if (typeof process !== 'undefined' && process.release.name === 'node') {
|
|
let { isNativeError } = require('node:util/types');
|
|
expect(isNativeError(new CanceledError('My Canceled Error'))).toBeTruthy();
|
|
}
|
|
});
|
|
});
|