Skip to content

Commit

Permalink
Export classes from type definition (axios#5031)
Browse files Browse the repository at this point in the history
  • Loading branch information
wai-ti8m committed Oct 7, 2022
1 parent 9c3dce3 commit b72e8fb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 2 additions & 0 deletions index.js
@@ -1,2 +1,4 @@
import axios from './lib/axios.js';

export * from './lib/axios.js';
export default axios;
20 changes: 19 additions & 1 deletion test/unit/regression/bugs.js
@@ -1,5 +1,5 @@
import assert from 'assert';
import axios from '../../../index.js';
import axios, { AxiosError, AxiosHeaders, Axios, CanceledError } from '../../../index.js';

describe('issues', function () {
describe('4999', function () {
Expand All @@ -10,4 +10,22 @@ describe('issues', function () {
assert.strictEqual(data.args.foo2, 'bar2');
});
});

describe('5031', function () {
it('should export class AxiosHeaders', async function () {
assert.doesNotThrow(() => new AxiosHeaders(), 'class AxiosHeaders not exported');
});

it('should export class Axios', async function () {
assert.doesNotThrow(() => new Axios(), 'class Axios not exported');
});

it('should export class AxiosError', async function () {
assert.doesNotThrow(() => new AxiosError('Error'), 'class AxiosError not exported');
});

it('should export class CanceledError', async function () {
assert.doesNotThrow(() => new CanceledError('Message'), 'class CanceledError not exported');
});
});
});

0 comments on commit b72e8fb

Please sign in to comment.