mirror of
https://github.com/tenrok/axios.git
synced 2026-06-17 19:21:29 +03:00
fa337332b9
* chore: small fixes to tests * feat: transitional move to vitests * feat: moving unit tests in progress * feat: moving more unit tests over * feat: more tests moved * feat: updated more sections of the http test * chore: wip http tests * chore: wip http tests * chore: more http tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: tests * chore: remove un-needed docs * chore: update package lock * chore: update lock
23 lines
924 B
JavaScript
23 lines
924 B
JavaScript
/* eslint-env mocha */
|
|
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();
|
|
}
|
|
});
|
|
});
|