refactor: Add a few lint rules to test files in /spec (#9815)
This commit is contained in:
@@ -12,28 +12,28 @@ describe('GameCenterAuth Adapter', function () {
|
|||||||
const gcProd4 = fs.readFileSync(path.resolve(__dirname, '../../support/cert/gc-prod-4.cer'));
|
const gcProd4 = fs.readFileSync(path.resolve(__dirname, '../../support/cert/gc-prod-4.cer'));
|
||||||
const digicertPem = fs.readFileSync(path.resolve(__dirname, '../../support/cert/DigiCertTrustedG4CodeSigningRSA4096SHA3842021CA1.crt.pem')).toString();
|
const digicertPem = fs.readFileSync(path.resolve(__dirname, '../../support/cert/DigiCertTrustedG4CodeSigningRSA4096SHA3842021CA1.crt.pem')).toString();
|
||||||
|
|
||||||
mockFetch([
|
mockFetch([
|
||||||
{
|
{
|
||||||
url: 'https://static.gc.apple.com/public-key/gc-prod-4.cer',
|
url: 'https://static.gc.apple.com/public-key/gc-prod-4.cer',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
response: {
|
response: {
|
||||||
ok: true,
|
ok: true,
|
||||||
headers: new Map(),
|
headers: new Map(),
|
||||||
arrayBuffer: () => Promise.resolve(
|
arrayBuffer: () => Promise.resolve(
|
||||||
gcProd4.buffer.slice(gcProd4.byteOffset, gcProd4.byteOffset + gcProd4.length)
|
gcProd4.buffer.slice(gcProd4.byteOffset, gcProd4.byteOffset + gcProd4.length)
|
||||||
),
|
),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
{
|
||||||
{
|
url: 'https://cacerts.digicert.com/DigiCertTrustedG4CodeSigningRSA4096SHA3842021CA1.crt.pem',
|
||||||
url: 'https://cacerts.digicert.com/DigiCertTrustedG4CodeSigningRSA4096SHA3842021CA1.crt.pem',
|
method: 'GET',
|
||||||
method: 'GET',
|
response: {
|
||||||
response: {
|
ok: true,
|
||||||
ok: true,
|
headers: new Map([['content-type', 'application/x-pem-file'], ['content-length', digicertPem.length.toString()]]),
|
||||||
headers: new Map([['content-type', 'application/x-pem-file'], ['content-length', digicertPem.length.toString()]]),
|
text: () => Promise.resolve(digicertPem),
|
||||||
text: () => Promise.resolve(digicertPem),
|
},
|
||||||
},
|
}
|
||||||
}
|
]);
|
||||||
]);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Test config failing due to missing params or wrong types', function () {
|
describe('Test config failing due to missing params or wrong types', function () {
|
||||||
|
|||||||
@@ -3502,7 +3502,7 @@ describe('afterLogin hook', () => {
|
|||||||
'X-Parse-REST-API-Key': 'rest',
|
'X-Parse-REST-API-Key': 'rest',
|
||||||
'X-Parse-Cloud-Context': '{"a":"a"}',
|
'X-Parse-Cloud-Context': '{"a":"a"}',
|
||||||
},
|
},
|
||||||
body: JSON.stringify({_context: { hello: 'world' }}),
|
body: JSON.stringify({ _context: { hello: 'world' } }),
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -4047,7 +4047,7 @@ describe('Parse.File hooks', () => {
|
|||||||
});
|
});
|
||||||
expect(response.headers['content-disposition']).toBe(`attachment;filename=${file._name}`);
|
expect(response.headers['content-disposition']).toBe(`attachment;filename=${file._name}`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Cloud Config hooks', () => {
|
describe('Cloud Config hooks', () => {
|
||||||
function testConfig() {
|
function testConfig() {
|
||||||
|
|||||||
@@ -647,7 +647,6 @@ describe('Email Verification Token Expiration:', () => {
|
|||||||
|
|
||||||
it_id('b6c87f35-d887-477d-bc86-a9217a424f53')(it)('setting the email on the user should set a new email verification token and new expiration date for the token when expire email verify token flag is set', async () => {
|
it_id('b6c87f35-d887-477d-bc86-a9217a424f53')(it)('setting the email on the user should set a new email verification token and new expiration date for the token when expire email verify token flag is set', async () => {
|
||||||
const user = new Parse.User();
|
const user = new Parse.User();
|
||||||
let userBeforeEmailReset;
|
|
||||||
|
|
||||||
let sendEmailOptions;
|
let sendEmailOptions;
|
||||||
const sendPromise = resolvingPromise();
|
const sendPromise = resolvingPromise();
|
||||||
@@ -680,7 +679,7 @@ describe('Email Verification Token Expiration:', () => {
|
|||||||
return results[0];
|
return results[0];
|
||||||
});
|
});
|
||||||
expect(typeof userFromDb).toBe('object');
|
expect(typeof userFromDb).toBe('object');
|
||||||
userBeforeEmailReset = userFromDb;
|
const userBeforeEmailReset = userFromDb;
|
||||||
|
|
||||||
// trigger another token generation by setting the email
|
// trigger another token generation by setting the email
|
||||||
user.set('email', 'user@parse.com');
|
user.set('email', 'user@parse.com');
|
||||||
@@ -713,7 +712,6 @@ describe('Email Verification Token Expiration:', () => {
|
|||||||
const user = new Parse.User();
|
const user = new Parse.User();
|
||||||
let sendEmailOptions;
|
let sendEmailOptions;
|
||||||
let sendVerificationEmailCallCount = 0;
|
let sendVerificationEmailCallCount = 0;
|
||||||
let userBeforeRequest;
|
|
||||||
const promise1 = resolvingPromise();
|
const promise1 = resolvingPromise();
|
||||||
const promise2 = resolvingPromise();
|
const promise2 = resolvingPromise();
|
||||||
const emailAdapter = {
|
const emailAdapter = {
|
||||||
@@ -748,7 +746,7 @@ describe('Email Verification Token Expiration:', () => {
|
|||||||
return results[0];
|
return results[0];
|
||||||
});
|
});
|
||||||
// store this user before we make our email request
|
// store this user before we make our email request
|
||||||
userBeforeRequest = newUser;
|
const userBeforeRequest = newUser;
|
||||||
|
|
||||||
expect(sendVerificationEmailCallCount).toBe(1);
|
expect(sendVerificationEmailCallCount).toBe(1);
|
||||||
|
|
||||||
|
|||||||
@@ -48,10 +48,20 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
"no-console": "off",
|
indent: ["error", 2, { SwitchCase: 1 }],
|
||||||
"no-var": "error",
|
"linebreak-style": ["error", "unix"],
|
||||||
"no-unused-vars": "off",
|
"no-trailing-spaces": "error",
|
||||||
|
"eol-last": "error",
|
||||||
|
"space-in-parens": ["error", "never"],
|
||||||
|
"no-multiple-empty-lines": "warn",
|
||||||
|
"prefer-const": "error",
|
||||||
|
"space-infix-ops": "error",
|
||||||
"no-useless-escape": "off",
|
"no-useless-escape": "off",
|
||||||
}
|
"require-atomic-updates": "off",
|
||||||
|
"object-curly-spacing": ["error", "always"],
|
||||||
|
curly: ["error", "all"],
|
||||||
|
"block-spacing": ["error", "always"],
|
||||||
|
"no-unused-vars": "off",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user