mirror of
https://github.com/axios/axios.git
synced 2026-04-16 03:45:48 +08:00
* chore: port karma tests * chore: port karma tests * chore: port karma tests * chore: tests * chore: tests * chore: tests * chore: fix issues with port collisions * refactor: utils tests * refactor: utils tests * refactor: utils tests * refactor: tests to vitests * refactor: tests to vitests * refactor: tests to vitests * refactor: tests to vitests * refactor: tests to vitests * refactor: tests to vitests * refactor: tests to vitests * refactor: ci * chore: install pw deps * chore: fixx ai feedback * chore: wip compatability tests * chore: wip compatability tests * chore: wip compatability tests * refactor: wip smoke * chore: smoke test run * chore: update unzip * chore: update testing * chore: update testing * chore: update testing * chore: update testing * chore: update testing * chore: skip tests that cannot run on node 16 and lower * chore: fix 16x under tests * chore: rest of tests * fix: functions and runs * feat: added tests for esm smoke * feat: added smoke * chore: ignore ai gen plans * chore: ci fixes * chore: fix small p2s
24 lines
830 B
JavaScript
24 lines
830 B
JavaScript
import { describe, it, expect } from 'vitest';
|
|
import { isNativeError } from 'node:util/types';
|
|
import CanceledError from '../../../lib/cancel/CanceledError.js';
|
|
|
|
describe('cancel::CanceledError', () => {
|
|
describe('toString', () => {
|
|
it('returns the default message when message is not specified', () => {
|
|
const cancel = new CanceledError();
|
|
|
|
expect(cancel.toString()).toBe('CanceledError: canceled');
|
|
});
|
|
|
|
it('returns the provided message when message is specified', () => {
|
|
const cancel = new CanceledError('Operation has been canceled.');
|
|
|
|
expect(cancel.toString()).toBe('CanceledError: Operation has been canceled.');
|
|
});
|
|
});
|
|
|
|
it('is recognized as a native error by Node util/types', () => {
|
|
expect(isNativeError(new CanceledError('My Canceled Error'))).toBe(true);
|
|
});
|
|
});
|