Enable prefer-const lint rule (#3202)
This commit is contained in:
committed by
Florent Vilmart
parent
a6c988176e
commit
ca286b7108
@@ -5,7 +5,7 @@ var Config = require('../src/Config');
|
||||
|
||||
const successfulTransmissions = function(body, installations) {
|
||||
|
||||
let promises = installations.map((device) => {
|
||||
const promises = installations.map((device) => {
|
||||
return Promise.resolve({
|
||||
transmitted: true,
|
||||
device: device,
|
||||
@@ -17,7 +17,7 @@ const successfulTransmissions = function(body, installations) {
|
||||
|
||||
const successfulIOS = function(body, installations) {
|
||||
|
||||
let promises = installations.map((device) => {
|
||||
const promises = installations.map((device) => {
|
||||
return Promise.resolve({
|
||||
transmitted: device.deviceType == "ios",
|
||||
device: device,
|
||||
@@ -138,7 +138,7 @@ describe('PushController', () => {
|
||||
}}
|
||||
var installations = [];
|
||||
while(installations.length != 10) {
|
||||
let installation = new Parse.Object("_Installation");
|
||||
const installation = new Parse.Object("_Installation");
|
||||
installation.set("installationId", "installation_"+installations.length);
|
||||
installation.set("deviceToken","device_token_"+installations.length)
|
||||
installation.set("badge", installations.length);
|
||||
@@ -148,7 +148,7 @@ describe('PushController', () => {
|
||||
}
|
||||
|
||||
while(installations.length != 15) {
|
||||
let installation = new Parse.Object("_Installation");
|
||||
const installation = new Parse.Object("_Installation");
|
||||
installation.set("installationId", "installation_"+installations.length);
|
||||
installation.set("deviceToken","device_token_"+installations.length)
|
||||
installation.set("deviceType", "android");
|
||||
@@ -279,16 +279,16 @@ describe('PushController', () => {
|
||||
|
||||
var pushController = new PushController(pushAdapter, Parse.applicationId, defaultConfiguration.push);
|
||||
Parse.Object.saveAll(installations).then((installations) => {
|
||||
let objectIds = installations.map(installation => {
|
||||
const objectIds = installations.map(installation => {
|
||||
return installation.id;
|
||||
})
|
||||
let where = {
|
||||
const where = {
|
||||
objectId: {'$in': objectIds.slice(0, 5)}
|
||||
}
|
||||
return pushController.sendPush(payload, where, config, auth);
|
||||
}).then(() => {
|
||||
expect(matchedInstallationsCount).toBe(5);
|
||||
let query = new Parse.Query(Parse.Installation);
|
||||
const query = new Parse.Query(Parse.Installation);
|
||||
query.equalTo('badge', 1);
|
||||
return query.find({useMasterKey: true});
|
||||
}).then((installations) => {
|
||||
@@ -304,7 +304,7 @@ describe('PushController', () => {
|
||||
|
||||
var installations = [];
|
||||
while(installations.length != 10) {
|
||||
let installation = new Parse.Object("_Installation");
|
||||
const installation = new Parse.Object("_Installation");
|
||||
installation.set("installationId", "installation_"+installations.length);
|
||||
installation.set("deviceToken","device_token_"+installations.length)
|
||||
installation.set("badge", installations.length);
|
||||
@@ -314,7 +314,7 @@ describe('PushController', () => {
|
||||
}
|
||||
|
||||
while(installations.length != 15) {
|
||||
let installation = new Parse.Object("_Installation");
|
||||
const installation = new Parse.Object("_Installation");
|
||||
installation.set("installationId", "installation_"+installations.length);
|
||||
installation.set("deviceToken","device_token_"+installations.length)
|
||||
installation.set("deviceType", "android");
|
||||
@@ -349,11 +349,11 @@ describe('PushController', () => {
|
||||
}, 1000);
|
||||
});
|
||||
}).then(() => {
|
||||
let query = new Parse.Query('_PushStatus');
|
||||
const query = new Parse.Query('_PushStatus');
|
||||
return query.find({useMasterKey: true});
|
||||
}).then((results) => {
|
||||
expect(results.length).toBe(1);
|
||||
let result = results[0];
|
||||
const result = results[0];
|
||||
expect(result.createdAt instanceof Date).toBe(true);
|
||||
expect(result.updatedAt instanceof Date).toBe(true);
|
||||
expect(result.id.length).toBe(10);
|
||||
@@ -371,7 +371,7 @@ describe('PushController', () => {
|
||||
'android': 5 // android
|
||||
});
|
||||
// Try to get it without masterKey
|
||||
let query = new Parse.Query('_PushStatus');
|
||||
const query = new Parse.Query('_PushStatus');
|
||||
return query.find();
|
||||
}).then((results) => {
|
||||
expect(results.length).toBe(0);
|
||||
@@ -393,7 +393,7 @@ describe('PushController', () => {
|
||||
return ["ios"];
|
||||
}
|
||||
}
|
||||
let where = { 'channels': {
|
||||
const where = { 'channels': {
|
||||
'$ins': ['Giants', 'Mets']
|
||||
}};
|
||||
var payload = {data: {
|
||||
@@ -409,10 +409,10 @@ describe('PushController', () => {
|
||||
fail('should not succeed');
|
||||
done();
|
||||
}).catch(() => {
|
||||
let query = new Parse.Query('_PushStatus');
|
||||
const query = new Parse.Query('_PushStatus');
|
||||
query.find({useMasterKey: true}).then((results) => {
|
||||
expect(results.length).toBe(1);
|
||||
let pushStatus = results[0];
|
||||
const pushStatus = results[0];
|
||||
expect(pushStatus.get('status')).toBe('failed');
|
||||
done();
|
||||
});
|
||||
@@ -439,7 +439,7 @@ describe('PushController', () => {
|
||||
isMaster: true
|
||||
}
|
||||
|
||||
let where = {
|
||||
const where = {
|
||||
'deviceToken': {
|
||||
'$inQuery': {
|
||||
'where': {
|
||||
@@ -480,7 +480,7 @@ describe('PushController', () => {
|
||||
isMaster: true
|
||||
}
|
||||
|
||||
let where = {
|
||||
const where = {
|
||||
'deviceToken': {
|
||||
'$inQuery': {
|
||||
'where': {
|
||||
|
||||
Reference in New Issue
Block a user