2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-17 19:21:29 +03:00

style: turn '()=>' into '() =>' (#6324)

Co-authored-by: Jay <jasonsaayman@gmail.com>
This commit is contained in:
Justin Dhillon
2025-11-12 11:49:37 -08:00
committed by GitHub
parent f73474d02c
commit 4d06112452
11 changed files with 29 additions and 29 deletions
+5 -5
View File
@@ -44,7 +44,7 @@ const remove = async (file) => {
describe('module', function () {
before(async ()=> {
before(async () => {
console.log('✓ Creating build backup...');
await fs.copy('./dist/', BACKUP_PATH);
console.log('✓ Exec build script...');
@@ -149,10 +149,10 @@ describe('module', function () {
});
describe('typings', () => {
describe('ESM', ()=> {
describe('ESM', () => {
const pkgPath = path.join(__dirname, './typings/esm');
after(async ()=> {
after(async () => {
await remove(path.join(pkgPath, './node_modules'));
});
@@ -166,10 +166,10 @@ describe('module', function () {
});
});
describe('CommonJS', ()=> {
describe('CommonJS', () => {
const pkgPath = path.join(__dirname, './typings/cjs');
after(async ()=> {
after(async () => {
await remove(path.join(pkgPath, './node_modules'));
});
+1 -1
View File
@@ -101,7 +101,7 @@ describe('core::mergeConfig', function() {
expect(merged.nestedConfig.propertyOnRequestConfig).toEqual(true);
});
describe('headers', ()=> {
describe('headers', () => {
it('should allow merging with AxiosHeaders instances', () => {
const merged = mergeConfig({
headers: new AxiosHeaders({
+1 -1
View File
@@ -133,7 +133,7 @@ describe('headers', function () {
});
});
it('should allow an AxiosHeaders instance to be used as the value of the headers option', async ()=> {
it('should allow an AxiosHeaders instance to be used as the value of the headers option', async () => {
const instance = axios.create({
headers: new AxiosHeaders({
xFoo: 'foo',
+1 -1
View File
@@ -84,7 +84,7 @@ describe('utils::merge', function () {
expect(d.a).not.toBe(a);
});
it('should support caseless option', ()=> {
it('should support caseless option', () => {
const a = {x: 1};
const b = {X: 2};
const merged = merge.call({caseless: true}, a, b);
+2 -2
View File
@@ -26,12 +26,12 @@ describe('adapters', function () {
it('should detect adapter unavailable status', function () {
adapters.adapters['testadapter'] = null;
assert.throws(()=> adapters.getAdapter('testAdapter'), /is not available in the build/)
assert.throws(() => adapters.getAdapter('testAdapter'), /is not available in the build/)
});
it('should detect adapter unsupported status', function () {
adapters.adapters['testadapter'] = false;
assert.throws(()=> adapters.getAdapter('testAdapter'), /is not supported by the environment/)
assert.throws(() => adapters.getAdapter('testAdapter'), /is not supported by the environment/)
});
it('should pick suitable adapter from the list', function () {
+9 -9
View File
@@ -66,7 +66,7 @@ function toleranceRange(positive, negative) {
const nodeVersion = process.versions.node.split('.').map(v => parseInt(v, 10));
const nodeMajorVersion = nodeVersion[0];
var noop = ()=> {};
var noop = () => {};
describe('supports http with nodejs', function () {
afterEach(async function () {
@@ -541,7 +541,7 @@ describe('supports http with nodejs', function () {
});
});
describe('algorithms', ()=> {
describe('algorithms', () => {
const responseBody ='str';
for (const [typeName, zipped] of Object.entries({
@@ -783,7 +783,7 @@ describe('supports http with nodejs', function () {
// consume the req stream
req.on('data', noop);
// and wait for the end before responding, otherwise an ECONNRESET error will be thrown
req.on('end', ()=> {
req.on('end', () => {
res.end('OK');
});
}).listen(4444, function (err) {
@@ -1844,7 +1844,7 @@ describe('supports http with nodejs', function () {
const dataURI = 'data:application/octet-stream;base64,' + buffer.toString('base64');
axios.get(dataURI).then(({data})=> {
axios.get(dataURI).then(({data}) => {
assert.deepStrictEqual(data, buffer);
done();
}).catch(done);
@@ -1861,7 +1861,7 @@ describe('supports http with nodejs', function () {
const dataURI = 'data:application/octet-stream;base64,' + buffer.toString('base64');
axios.get(dataURI, {responseType: 'blob'}).then(async ({data})=> {
axios.get(dataURI, {responseType: 'blob'}).then(async ({data}) => {
assert.strictEqual(data.type, 'application/octet-stream');
assert.deepStrictEqual(await data.text(), '123');
done();
@@ -1873,7 +1873,7 @@ describe('supports http with nodejs', function () {
const dataURI = 'data:application/octet-stream;base64,' + buffer.toString('base64');
axios.get(dataURI, {responseType: "text"}).then(({data})=> {
axios.get(dataURI, {responseType: "text"}).then(({data}) => {
assert.deepStrictEqual(data, '123');
done();
}).catch(done);
@@ -1884,7 +1884,7 @@ describe('supports http with nodejs', function () {
const dataURI = 'data:application/octet-stream;base64,' + buffer.toString('base64');
axios.get(dataURI, {responseType: "stream"}).then(({data})=> {
axios.get(dataURI, {responseType: "stream"}).then(({data}) => {
var str = '';
data.on('data', function(response){
@@ -2049,7 +2049,7 @@ describe('supports http with nodejs', function () {
maxRedirects: 0
});
samples.slice(skip).forEach(({rate, progress}, i, _samples)=> {
samples.slice(skip).forEach(({rate, progress}, i, _samples) => {
assert.ok(compareValues(rate, configRate),
`Rate sample at index ${i} is out of the expected range (${rate} / ${configRate}) [${
_samples.map(({rate}) => rate).join(', ')
@@ -2097,7 +2097,7 @@ describe('supports http with nodejs', function () {
maxRedirects: 0
});
samples.slice(skip).forEach(({rate, progress}, i, _samples)=> {
samples.slice(skip).forEach(({rate, progress}, i, _samples) => {
assert.ok(compareValues(rate, configRate),
`Rate sample at index ${i} is out of the expected range (${rate} / ${configRate}) [${
_samples.map(({rate}) => rate).join(', ')
+5 -5
View File
@@ -168,12 +168,12 @@ describe('AxiosHeaders', function () {
headers.set('foo', 'bar=value1');
assert.strictEqual(headers.has('foo', (value, header, headers)=> {
assert.strictEqual(headers.has('foo', (value, header, headers) => {
assert.strictEqual(value, 'bar=value1');
assert.strictEqual(header, 'foo');
return true;
}), true);
assert.strictEqual(headers.has('foo', ()=> false), false);
assert.strictEqual(headers.has('foo', () => false), false);
});
it('should support string pattern', function () {
@@ -246,7 +246,7 @@ describe('AxiosHeaders', function () {
headers.set('foo', 'bar=value1');
headers.delete('foo', (value, header)=> {
headers.delete('foo', (value, header) => {
assert.strictEqual(value, 'bar=value1');
assert.strictEqual(header, 'foo');
return false;
@@ -254,7 +254,7 @@ describe('AxiosHeaders', function () {
assert.strictEqual(headers.has('foo'), true);
assert.strictEqual(headers.delete('foo', ()=> true), true);
assert.strictEqual(headers.delete('foo', () => true), true);
assert.strictEqual(headers.has('foo'), false);
});
@@ -277,7 +277,7 @@ describe('AxiosHeaders', function () {
});
});
describe('clear', ()=> {
describe('clear', () => {
it('should clear all headers', () => {
const headers = new AxiosHeaders({x: 1, y:2});