diff --git a/spec/Adapters/Auth/gcenter.spec.js b/spec/Adapters/Auth/gcenter.spec.js index c025412ce3..45e94a527f 100644 --- a/spec/Adapters/Auth/gcenter.spec.js +++ b/spec/Adapters/Auth/gcenter.spec.js @@ -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 () { diff --git a/spec/CloudCode.spec.js b/spec/CloudCode.spec.js index 59ae534df2..0b881bef47 100644 --- a/spec/CloudCode.spec.js +++ b/spec/CloudCode.spec.js @@ -3502,9 +3502,9 @@ 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' } }), }); - + }); it('should have access to context when saving a new object', async () => { @@ -3929,7 +3929,7 @@ describe('saveFile hooks', () => { }); }); -describe('Parse.File hooks', () => { +describe('Parse.File hooks', () => { it('find hooks should run', async () => { const file = new Parse.File('popeye.txt', [1, 2, 3], 'text/plain'); await file.save({ useMasterKey: true }); @@ -4047,7 +4047,7 @@ describe('Parse.File hooks', () => { }); expect(response.headers['content-disposition']).toBe(`attachment;filename=${file._name}`); }); - }); +}); describe('Cloud Config hooks', () => { function testConfig() { diff --git a/spec/EmailVerificationToken.spec.js b/spec/EmailVerificationToken.spec.js index 6dd0a01966..1a235d8d13 100644 --- a/spec/EmailVerificationToken.spec.js +++ b/spec/EmailVerificationToken.spec.js @@ -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); @@ -1011,7 +1009,7 @@ describe('Email Verification Token Expiration:', () => { }) .then(fail) .catch(response => response); - + expect(response.status).toBe(400); expect(sendVerificationEmailCallCount).toBe(0); expect(sendEmailOptions).not.toBeDefined(); diff --git a/spec/ParseGraphQLServer.spec.js b/spec/ParseGraphQLServer.spec.js index 414310d05e..f324924d37 100644 --- a/spec/ParseGraphQLServer.spec.js +++ b/spec/ParseGraphQLServer.spec.js @@ -456,7 +456,7 @@ describe('ParseGraphQLServer', () => { } beforeEach(async () => { - await createGQLFromParseServer(parseServer); + await createGQLFromParseServer(parseServer); const subscriptionClient = new SubscriptionClient( 'ws://localhost:13377/subscriptions', diff --git a/spec/ParseLiveQuery.spec.js b/spec/ParseLiveQuery.spec.js index 98d7e6a6c9..7ce757a17b 100644 --- a/spec/ParseLiveQuery.spec.js +++ b/spec/ParseLiveQuery.spec.js @@ -1182,7 +1182,7 @@ describe('ParseLiveQuery', function () { await sleep(100); expect(server.liveQueryServer.server.address()).toBeNull(); expect(server.liveQueryServer.subscriber.isOpen).toBeFalse(); - + liveQueryConnectionCount = await getConnectionsCount(server.liveQueryServer.server); expect(liveQueryConnectionCount).toBe(0); }); diff --git a/spec/ParseQuery.spec.js b/spec/ParseQuery.spec.js index a8ed838d23..0e4039979a 100644 --- a/spec/ParseQuery.spec.js +++ b/spec/ParseQuery.spec.js @@ -5312,7 +5312,7 @@ describe('Parse.Query testing', () => { const child = new Parse.Object('Child'); child.set('key', 'value'); await child.save(); - + const parent = new Parse.Object('Parent'); parent.set('some', { nested: { @@ -5322,19 +5322,19 @@ describe('Parse.Query testing', () => { }, }); await parent.save(); - + const query1 = await new Parse.Query('Parent') .equalTo('some.nested.key.child', child) .find(); - + expect(query1.length).toEqual(1); }); - + it('queries nested key using containedIn', async () => { const child = new Parse.Object('Child'); child.set('key', 'value'); await child.save(); - + const parent = new Parse.Object('Parent'); parent.set('some', { nested: { @@ -5344,19 +5344,19 @@ describe('Parse.Query testing', () => { }, }); await parent.save(); - + const query1 = await new Parse.Query('Parent') .containedIn('some.nested.key.child', [child]) .find(); - + expect(query1.length).toEqual(1); }); - + it('queries nested key using matchesQuery', async () => { const child = new Parse.Object('Child'); child.set('key', 'value'); await child.save(); - + const parent = new Parse.Object('Parent'); parent.set('some', { nested: { @@ -5366,11 +5366,11 @@ describe('Parse.Query testing', () => { }, }); await parent.save(); - + const query1 = await new Parse.Query('Parent') .matchesQuery('some.nested.key.child', new Parse.Query('Child').equalTo('key', 'value')) .find(); - + expect(query1.length).toEqual(1); }); }); diff --git a/spec/Utils.spec.js b/spec/Utils.spec.js index fe86854e33..14747af6aa 100644 --- a/spec/Utils.spec.js +++ b/spec/Utils.spec.js @@ -8,7 +8,7 @@ describe('Utils', () => { ] for (const value of values) { expect(Utils.encodeForUrl(value.input)).toBe(value.output); - } + } }); }); diff --git a/spec/eslint.config.js b/spec/eslint.config.js index e870d91642..6d280d08e3 100644 --- a/spec/eslint.config.js +++ b/spec/eslint.config.js @@ -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", + }, }, ]; diff --git a/spec/support/CurrentSpecReporter.js b/spec/support/CurrentSpecReporter.js index 4f4968fdcb..3e11d60c56 100755 --- a/spec/support/CurrentSpecReporter.js +++ b/spec/support/CurrentSpecReporter.js @@ -114,4 +114,4 @@ global.retryFlakyTests = function() { }; } -module.exports = CurrentSpecReporter; \ No newline at end of file +module.exports = CurrentSpecReporter;