Enable prefer-const lint rule (#3202)
This commit is contained in:
committed by
Florent Vilmart
parent
a6c988176e
commit
ca286b7108
@@ -2,15 +2,15 @@
|
||||
// These tests check the Installations functionality of the REST API.
|
||||
// Ported from installation_collection_test.go
|
||||
|
||||
let auth = require('../src/Auth');
|
||||
let Config = require('../src/Config');
|
||||
let Parse = require('parse/node').Parse;
|
||||
let rest = require('../src/rest');
|
||||
let request = require("request");
|
||||
const auth = require('../src/Auth');
|
||||
const Config = require('../src/Config');
|
||||
const Parse = require('parse/node').Parse;
|
||||
const rest = require('../src/rest');
|
||||
const request = require("request");
|
||||
|
||||
let config;
|
||||
let database;
|
||||
let defaultColumns = require('../src/Controllers/SchemaController').defaultColumns;
|
||||
const defaultColumns = require('../src/Controllers/SchemaController').defaultColumns;
|
||||
|
||||
const installationSchema = { fields: Object.assign({}, defaultColumns._Default, defaultColumns._Installation) };
|
||||
|
||||
@@ -130,7 +130,7 @@ describe('Installations', () => {
|
||||
};
|
||||
rest.create(config, auth.nobody(config), '_Installation', input)
|
||||
.then(() => {
|
||||
let query = new Parse.Query(Parse.Installation);
|
||||
const query = new Parse.Query(Parse.Installation);
|
||||
return query.find()
|
||||
}).then(() => {
|
||||
fail('Should not succeed!');
|
||||
@@ -151,7 +151,7 @@ describe('Installations', () => {
|
||||
};
|
||||
rest.create(config, auth.nobody(config), '_Installation', input)
|
||||
.then(() => {
|
||||
let query = new Parse.Query(Parse.Installation);
|
||||
const query = new Parse.Query(Parse.Installation);
|
||||
return query.find({useMasterKey: true});
|
||||
}).then((results) => {
|
||||
expect(results.length).toEqual(1);
|
||||
@@ -842,15 +842,15 @@ describe('Installations', () => {
|
||||
});
|
||||
|
||||
it('allows you to get your own installation (regression test for #1718)', done => {
|
||||
let installId = '12345678-abcd-abcd-abcd-123456789abc';
|
||||
let device = 'android';
|
||||
let input = {
|
||||
const installId = '12345678-abcd-abcd-abcd-123456789abc';
|
||||
const device = 'android';
|
||||
const input = {
|
||||
'installationId': installId,
|
||||
'deviceType': device
|
||||
};
|
||||
rest.create(config, auth.nobody(config), '_Installation', input)
|
||||
.then(createResult => {
|
||||
let headers = {
|
||||
const headers = {
|
||||
'X-Parse-Application-Id': 'test',
|
||||
'X-Parse-REST-API-Key': 'rest',
|
||||
};
|
||||
@@ -871,15 +871,15 @@ describe('Installations', () => {
|
||||
});
|
||||
|
||||
it('allows you to update installation from header (#2090)', done => {
|
||||
let installId = '12345678-abcd-abcd-abcd-123456789abc';
|
||||
let device = 'android';
|
||||
let input = {
|
||||
const installId = '12345678-abcd-abcd-abcd-123456789abc';
|
||||
const device = 'android';
|
||||
const input = {
|
||||
'installationId': installId,
|
||||
'deviceType': device
|
||||
};
|
||||
rest.create(config, auth.nobody(config), '_Installation', input)
|
||||
.then(() => {
|
||||
let headers = {
|
||||
const headers = {
|
||||
'X-Parse-Application-Id': 'test',
|
||||
'X-Parse-REST-API-Key': 'rest',
|
||||
'X-Parse-Installation-Id': installId
|
||||
@@ -905,15 +905,15 @@ describe('Installations', () => {
|
||||
});
|
||||
|
||||
it('allows you to update installation with masterKey', done => {
|
||||
let installId = '12345678-abcd-abcd-abcd-123456789abc';
|
||||
let device = 'android';
|
||||
let input = {
|
||||
const installId = '12345678-abcd-abcd-abcd-123456789abc';
|
||||
const device = 'android';
|
||||
const input = {
|
||||
'installationId': installId,
|
||||
'deviceType': device
|
||||
};
|
||||
rest.create(config, auth.nobody(config), '_Installation', input)
|
||||
.then(createResult => {
|
||||
let installationObj = Parse.Installation.createWithoutData(createResult.response.objectId);
|
||||
const installationObj = Parse.Installation.createWithoutData(createResult.response.objectId);
|
||||
installationObj.set('customField', 'custom value');
|
||||
return installationObj.save(null, {useMasterKey: true});
|
||||
}).then(updateResult => {
|
||||
@@ -928,14 +928,14 @@ describe('Installations', () => {
|
||||
});
|
||||
|
||||
it('should properly handle installation save #2780', done => {
|
||||
let installId = '12345678-abcd-abcd-abcd-123456789abc';
|
||||
let device = 'android';
|
||||
let input = {
|
||||
const installId = '12345678-abcd-abcd-abcd-123456789abc';
|
||||
const device = 'android';
|
||||
const input = {
|
||||
'installationId': installId,
|
||||
'deviceType': device
|
||||
};
|
||||
rest.create(config, auth.nobody(config), '_Installation', input).then(() => {
|
||||
let query = new Parse.Query(Parse.Installation);
|
||||
const query = new Parse.Query(Parse.Installation);
|
||||
query.equalTo('installationId', installId);
|
||||
query.first({useMasterKey: true}).then((installation) => {
|
||||
return installation.save({
|
||||
@@ -951,14 +951,14 @@ describe('Installations', () => {
|
||||
});
|
||||
|
||||
it('should properly reject updating installationId', done => {
|
||||
let installId = '12345678-abcd-abcd-abcd-123456789abc';
|
||||
let device = 'android';
|
||||
let input = {
|
||||
const installId = '12345678-abcd-abcd-abcd-123456789abc';
|
||||
const device = 'android';
|
||||
const input = {
|
||||
'installationId': installId,
|
||||
'deviceType': device
|
||||
};
|
||||
rest.create(config, auth.nobody(config), '_Installation', input).then(() => {
|
||||
let query = new Parse.Query(Parse.Installation);
|
||||
const query = new Parse.Query(Parse.Installation);
|
||||
query.equalTo('installationId', installId);
|
||||
query.first({useMasterKey: true}).then((installation) => {
|
||||
return installation.save({
|
||||
|
||||
Reference in New Issue
Block a user