ci: Expand ESLint to tests in BE packages (no-changelog) (#6147)

* 🔧 Adjust base ESLint config

* 🔧 Adjust `lint` and `lintfix` in `nodes-base`

* 🔧 Include `test` and `utils` in `nodes-base`

* 📘 Convert JS tests to TS

* 👕 Apply lintfixes
This commit is contained in:
Iván Ovejero
2023-05-02 10:37:19 +02:00
committed by GitHub
parent c63181b317
commit 06fa6f1fb3
59 changed files with 390 additions and 307 deletions

View File

@@ -17,7 +17,8 @@ describe('CurlConverterHelper', () => {
});
test('Should parse JSON content type correctly', () => {
const curl = `curl -X POST https://reqbin.com/echo/post/json -H 'Content-Type: application/json' -d '{"login":"my_login","password":"my_password"}'`;
const curl =
'curl -X POST https://reqbin.com/echo/post/json -H \'Content-Type: application/json\' -d \'{"login":"my_login","password":"my_password"}\'';
const parameters = toHttpNodeParameters(curl);
expect(parameters.url).toBe('https://reqbin.com/echo/post/json');
expect(parameters.sendBody).toBe(true);
@@ -31,7 +32,8 @@ describe('CurlConverterHelper', () => {
});
test('Should parse multipart-form-data content type correctly', () => {
const curl = `curl -X POST https://reqbin.com/echo/post/json -v -F key1=value1 -F upload=@localfilename`;
const curl =
'curl -X POST https://reqbin.com/echo/post/json -v -F key1=value1 -F upload=@localfilename';
const parameters = toHttpNodeParameters(curl);
expect(parameters.url).toBe('https://reqbin.com/echo/post/json');
expect(parameters.sendBody).toBe(true);
@@ -46,7 +48,8 @@ describe('CurlConverterHelper', () => {
});
test('Should parse binary request correctly', () => {
const curl = `curl --location --request POST 'https://www.website.com' --header 'Content-Type: image/png' --data-binary '@/Users/image.png`;
const curl =
"curl --location --request POST 'https://www.website.com' --header 'Content-Type: image/png' --data-binary '@/Users/image.png";
const parameters = toHttpNodeParameters(curl);
expect(parameters.url).toBe('https://www.website.com');
expect(parameters.method).toBe('POST');
@@ -74,7 +77,8 @@ describe('CurlConverterHelper', () => {
});
test('Should parse header properties and keep the original case', () => {
const curl = `curl -X POST https://reqbin.com/echo/post/json -v -F key1=value1 -F upload=@localfilename -H "ACCEPT: text/javascript" -H "content-type: multipart/form-data"`;
const curl =
'curl -X POST https://reqbin.com/echo/post/json -v -F key1=value1 -F upload=@localfilename -H "ACCEPT: text/javascript" -H "content-type: multipart/form-data"';
const parameters = toHttpNodeParameters(curl);
expect(parameters.url).toBe('https://reqbin.com/echo/post/json');
expect(parameters.sendBody).toBe(true);
@@ -91,7 +95,7 @@ describe('CurlConverterHelper', () => {
});
test('Should parse querystring properties', () => {
const curl = `curl -G -d 'q=kitties' -d 'count=20' https://google.com/search`;
const curl = "curl -G -d 'q=kitties' -d 'count=20' https://google.com/search";
const parameters = toHttpNodeParameters(curl);
expect(parameters.url).toBe('https://google.com/search');
expect(parameters.sendBody).toBe(false);
@@ -105,7 +109,7 @@ describe('CurlConverterHelper', () => {
});
test('Should parse basic authentication property and keep the original case', () => {
const curl = `curl https://reqbin.com/echo -u "login:password"`;
const curl = 'curl https://reqbin.com/echo -u "login:password"';
const parameters = toHttpNodeParameters(curl);
expect(parameters.url).toBe('https://reqbin.com/echo');
expect(parameters.sendBody).toBe(false);
@@ -119,7 +123,7 @@ describe('CurlConverterHelper', () => {
});
test('Should parse location flag with --location', () => {
const curl = `curl https://reqbin.com/echo -u "login:password" --location`;
const curl = 'curl https://reqbin.com/echo -u "login:password" --location';
const parameters = toHttpNodeParameters(curl);
expect(parameters.url).toBe('https://reqbin.com/echo');
expect(parameters.sendBody).toBe(false);
@@ -134,7 +138,7 @@ describe('CurlConverterHelper', () => {
});
test('Should parse location flag with --L', () => {
const curl = `curl https://reqbin.com/echo -u "login:password" -L`;
const curl = 'curl https://reqbin.com/echo -u "login:password" -L';
const parameters = toHttpNodeParameters(curl);
expect(parameters.url).toBe('https://reqbin.com/echo');
expect(parameters.sendBody).toBe(false);
@@ -149,7 +153,7 @@ describe('CurlConverterHelper', () => {
});
test('Should parse location and max redirects flags with --location and --max-redirs 10', () => {
const curl = `curl https://reqbin.com/echo -u "login:password" --location --max-redirs 10`;
const curl = 'curl https://reqbin.com/echo -u "login:password" --location --max-redirs 10';
const parameters = toHttpNodeParameters(curl);
expect(parameters.url).toBe('https://reqbin.com/echo');
expect(parameters.sendBody).toBe(false);
@@ -165,7 +169,7 @@ describe('CurlConverterHelper', () => {
});
test('Should parse proxy flag -x', () => {
const curl = `curl https://reqbin.com/echo -u "login:password" -x https://google.com`;
const curl = 'curl https://reqbin.com/echo -u "login:password" -x https://google.com';
const parameters = toHttpNodeParameters(curl);
expect(parameters.url).toBe('https://reqbin.com/echo');
expect(parameters.sendBody).toBe(false);
@@ -180,7 +184,7 @@ describe('CurlConverterHelper', () => {
});
test('Should parse proxy flag --proxy', () => {
const curl = `curl https://reqbin.com/echo -u "login:password" -x https://google.com`;
const curl = 'curl https://reqbin.com/echo -u "login:password" -x https://google.com';
const parameters = toHttpNodeParameters(curl);
expect(parameters.url).toBe('https://reqbin.com/echo');
expect(parameters.sendBody).toBe(false);
@@ -195,7 +199,7 @@ describe('CurlConverterHelper', () => {
});
test('Should parse include headers on output flag --include', () => {
const curl = `curl https://reqbin.com/echo -u "login:password" --include -x https://google.com`;
const curl = 'curl https://reqbin.com/echo -u "login:password" --include -x https://google.com';
const parameters = toHttpNodeParameters(curl);
expect(parameters.url).toBe('https://reqbin.com/echo');
expect(parameters.sendBody).toBe(false);
@@ -210,7 +214,7 @@ describe('CurlConverterHelper', () => {
});
test('Should parse include headers on output flag -i', () => {
const curl = `curl https://reqbin.com/echo -u "login:password" -x https://google.com -i`;
const curl = 'curl https://reqbin.com/echo -u "login:password" -x https://google.com -i';
const parameters = toHttpNodeParameters(curl);
expect(parameters.url).toBe('https://reqbin.com/echo');
expect(parameters.sendBody).toBe(false);
@@ -225,7 +229,7 @@ describe('CurlConverterHelper', () => {
});
test('Should parse include request flag -X', () => {
const curl = `curl -X POST https://reqbin.com/echo -u "login:password" -x https://google.com`;
const curl = 'curl -X POST https://reqbin.com/echo -u "login:password" -x https://google.com';
const parameters = toHttpNodeParameters(curl);
expect(parameters.url).toBe('https://reqbin.com/echo');
expect(parameters.method).toBe('POST');
@@ -233,7 +237,8 @@ describe('CurlConverterHelper', () => {
});
test('Should parse include request flag --request', () => {
const curl = `curl --request POST https://reqbin.com/echo -u "login:password" -x https://google.com`;
const curl =
'curl --request POST https://reqbin.com/echo -u "login:password" -x https://google.com';
const parameters = toHttpNodeParameters(curl);
expect(parameters.url).toBe('https://reqbin.com/echo');
expect(parameters.method).toBe('POST');
@@ -241,7 +246,8 @@ describe('CurlConverterHelper', () => {
});
test('Should parse include timeout flag --connect-timeout', () => {
const curl = `curl --request POST https://reqbin.com/echo -u "login:password" --connect-timeout 20`;
const curl =
'curl --request POST https://reqbin.com/echo -u "login:password" --connect-timeout 20';
const parameters = toHttpNodeParameters(curl);
expect(parameters.url).toBe('https://reqbin.com/echo');
expect(parameters.method).toBe('POST');
@@ -250,7 +256,7 @@ describe('CurlConverterHelper', () => {
});
test('Should parse download file flag -O', () => {
const curl = `curl --request POST https://reqbin.com/echo -u "login:password" -O`;
const curl = 'curl --request POST https://reqbin.com/echo -u "login:password" -O';
const parameters = toHttpNodeParameters(curl);
expect(parameters.url).toBe('https://reqbin.com/echo');
expect(parameters.method).toBe('POST');
@@ -260,7 +266,7 @@ describe('CurlConverterHelper', () => {
});
test('Should parse download file flag -o', () => {
const curl = `curl --request POST https://reqbin.com/echo -u "login:password" -o`;
const curl = 'curl --request POST https://reqbin.com/echo -u "login:password" -o';
const parameters = toHttpNodeParameters(curl);
expect(parameters.url).toBe('https://reqbin.com/echo');
expect(parameters.method).toBe('POST');
@@ -270,7 +276,7 @@ describe('CurlConverterHelper', () => {
});
test('Should parse ignore SSL flag -k', () => {
const curl = `curl --request POST https://reqbin.com/echo -u "login:password" -k`;
const curl = 'curl --request POST https://reqbin.com/echo -u "login:password" -k';
const parameters = toHttpNodeParameters(curl);
expect(parameters.url).toBe('https://reqbin.com/echo');
expect(parameters.method).toBe('POST');
@@ -279,7 +285,7 @@ describe('CurlConverterHelper', () => {
});
test('Should parse ignore SSL flag --insecure', () => {
const curl = `curl --request POST https://reqbin.com/echo -u "login:password" --insecure`;
const curl = 'curl --request POST https://reqbin.com/echo -u "login:password" --insecure';
const parameters = toHttpNodeParameters(curl);
expect(parameters.url).toBe('https://reqbin.com/echo');
expect(parameters.method).toBe('POST');