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 digicertPem = fs.readFileSync(path.resolve(__dirname, '../../support/cert/DigiCertTrustedG4CodeSigningRSA4096SHA3842021CA1.crt.pem')).toString();
|
||||
|
||||
mockFetch([
|
||||
{
|
||||
url: 'https://static.gc.apple.com/public-key/gc-prod-4.cer',
|
||||
method: 'GET',
|
||||
response: {
|
||||
ok: true,
|
||||
headers: new Map(),
|
||||
arrayBuffer: () => Promise.resolve(
|
||||
gcProd4.buffer.slice(gcProd4.byteOffset, gcProd4.byteOffset + gcProd4.length)
|
||||
),
|
||||
mockFetch([
|
||||
{
|
||||
url: 'https://static.gc.apple.com/public-key/gc-prod-4.cer',
|
||||
method: 'GET',
|
||||
response: {
|
||||
ok: true,
|
||||
headers: new Map(),
|
||||
arrayBuffer: () => Promise.resolve(
|
||||
gcProd4.buffer.slice(gcProd4.byteOffset, gcProd4.byteOffset + gcProd4.length)
|
||||
),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
url: 'https://cacerts.digicert.com/DigiCertTrustedG4CodeSigningRSA4096SHA3842021CA1.crt.pem',
|
||||
method: 'GET',
|
||||
response: {
|
||||
ok: true,
|
||||
headers: new Map([['content-type', 'application/x-pem-file'], ['content-length', digicertPem.length.toString()]]),
|
||||
text: () => Promise.resolve(digicertPem),
|
||||
},
|
||||
}
|
||||
]);
|
||||
{
|
||||
url: 'https://cacerts.digicert.com/DigiCertTrustedG4CodeSigningRSA4096SHA3842021CA1.crt.pem',
|
||||
method: 'GET',
|
||||
response: {
|
||||
ok: true,
|
||||
headers: new Map([['content-type', 'application/x-pem-file'], ['content-length', digicertPem.length.toString()]]),
|
||||
text: () => Promise.resolve(digicertPem),
|
||||
},
|
||||
}
|
||||
]);
|
||||
});
|
||||
|
||||
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-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}`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Cloud Config hooks', () => {
|
||||
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 () => {
|
||||
const user = new Parse.User();
|
||||
let userBeforeEmailReset;
|
||||
|
||||
let sendEmailOptions;
|
||||
const sendPromise = resolvingPromise();
|
||||
@@ -680,7 +679,7 @@ describe('Email Verification Token Expiration:', () => {
|
||||
return results[0];
|
||||
});
|
||||
expect(typeof userFromDb).toBe('object');
|
||||
userBeforeEmailReset = userFromDb;
|
||||
const userBeforeEmailReset = userFromDb;
|
||||
|
||||
// trigger another token generation by setting the email
|
||||
user.set('email', 'user@parse.com');
|
||||
@@ -713,7 +712,6 @@ describe('Email Verification Token Expiration:', () => {
|
||||
const user = new Parse.User();
|
||||
let sendEmailOptions;
|
||||
let sendVerificationEmailCallCount = 0;
|
||||
let userBeforeRequest;
|
||||
const promise1 = resolvingPromise();
|
||||
const promise2 = resolvingPromise();
|
||||
const emailAdapter = {
|
||||
@@ -748,7 +746,7 @@ describe('Email Verification Token Expiration:', () => {
|
||||
return results[0];
|
||||
});
|
||||
// store this user before we make our email request
|
||||
userBeforeRequest = newUser;
|
||||
const userBeforeRequest = newUser;
|
||||
|
||||
expect(sendVerificationEmailCallCount).toBe(1);
|
||||
|
||||
|
||||
@@ -48,10 +48,20 @@ module.exports = [
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
"no-console": "off",
|
||||
"no-var": "error",
|
||||
"no-unused-vars": "off",
|
||||
indent: ["error", 2, { SwitchCase: 1 }],
|
||||
"linebreak-style": ["error", "unix"],
|
||||
"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",
|
||||
}
|
||||
"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