Skip to content

Commit ef090cd

Browse files
author
Melih Korkmaz
committed
Fixed tests.js and no-loop eslint.
1 parent 58c53f1 commit ef090cd

File tree

4 files changed

+23
-22
lines changed

4 files changed

+23
-22
lines changed

plugins/plugins/api/api.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
var plugin = {},
22
fs = require('fs'),
33
path = require('path'),
4-
common = require('../../../api/utils/common.js'),
4+
common = require('../../../api/utils/common.js'),
55
parser = require('properties-parser'),
66
plugins = require('../../pluginManager.js');
77

@@ -14,7 +14,7 @@ var plugin = {},
1414
common.returnMessage(params, 401, 'User is not a global administrator');
1515
return false;
1616
}
17-
if (typeof params.qstring.plugin !== 'undefined' && params.qstring.plugin != 'plugins') {
17+
if (typeof params.qstring.plugin !== 'undefined' && params.qstring.plugin !== 'plugins') {
1818
try {
1919
params.qstring.plugin = JSON.parse(params.qstring.plugin);
2020
}
@@ -69,7 +69,7 @@ var plugin = {},
6969
list.forEach(function(file) {
7070
if (!ignore[file]) {
7171
var fullpath = dir + '/' + file;
72-
fs.stat(fullpath, function(err, stat) {
72+
fs.stat(fullpath, function(fsError, stat) {
7373
if (stat && stat.isDirectory()) {
7474
var data;
7575
try {

plugins/plugins/frontend/app.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ var exportedPlugin = {};
66
};
77
}(exportedPlugin));
88

9-
module.exports = exportedPlugin;
9+
module.exports = exportedPlugin;

plugins/plugins/frontend/public/javascripts/countly.views.js

+12-11
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,7 @@ window.ConfigurationsView = countlyView.extend({
945945
objectKeys.splice(objectKeys.indexOf("default"), 1);
946946
objectKeys.unshift('default');
947947
}
948+
948949
for (var a in objectKeys) {
949950
var i = objectKeys[a];
950951
if (typeof configsData[i] === "object" && i !== "_user") {
@@ -954,12 +955,12 @@ window.ConfigurationsView = countlyView.extend({
954955
var display = i === this.selectedNav.key ? this.userConfig ? "table-row" : "block" : this.userConfig ? "table-row" : "none";
955956

956957
// var category = "CORE";
957-
var relatedNav = this.navTitles.coreTitles.find(function(x) {
958+
var relatedNav = this.navTitles.coreTitles.find(function(x) { // eslint-disable-line no-loop-func
958959
return x.key === i;
959960
});
960961
if (!relatedNav) {
961962
// category = "PLUGINS";
962-
relatedNav = this.navTitles.pluginTitles.find(function(x) {
963+
relatedNav = this.navTitles.pluginTitles.find(function(x) { // eslint-disable-line no-loop-func
963964
return x.key === i;
964965
});
965966
}
@@ -976,19 +977,19 @@ window.ConfigurationsView = countlyView.extend({
976977
}
977978
else {
978979
var input = this.getInputByType((id + "." + i).substring(1), "");
979-
var label = this.getInputLabel((id + "." + i).substring(1), i);
980+
label = this.getInputLabel((id + "." + i).substring(1), i);
980981
if (input && label) {
981982
configsHTML += "<tr id='config-row-" + i + "-" + id.replace(".", "") + "' class='config-table-details-row'><td>" + label + "</td><td>" + input + "</td></tr>";
982983
}
983984
}
984985
}
985986
else if (i === "_user") {
986-
var hasSelectedData = Object.keys(configsData[i]).some(function(key) {
987+
var hasSelectedData = Object.keys(configsData[i]).some(function(key) { // eslint-disable-line no-loop-func
987988
return configsData[i][key];
988989
});
989-
var label = '<div data-localize="' + jQuery.i18n.map["configs.user-level-configuration"] + '">' + jQuery.i18n.map["configs.user-level-configuration"] + '</div><span class="config-help" data-localize="' + jQuery.i18n.map["configs.help.user-level-configuration"] + '">' + jQuery.i18n.map["configs.help.user-level-configuration"] + '</span>';
990+
label = '<div data-localize="' + jQuery.i18n.map["configs.user-level-configuration"] + '">' + jQuery.i18n.map["configs.user-level-configuration"] + '</div><span class="config-help" data-localize="' + jQuery.i18n.map["configs.help.user-level-configuration"] + '">' + jQuery.i18n.map["configs.help.user-level-configuration"] + '</span>';
990991

991-
var input = '<div class="cly-multi-select user-config-select ' + (hasSelectedData ? 'selection-exists' : '') + '" id="' + id.substring(1) + '._user" style="width: 100%; box-sizing: border-box;">';
992+
input = '<div class="cly-multi-select user-config-select ' + (hasSelectedData ? 'selection-exists' : '') + '" id="' + id.substring(1) + '._user" style="width: 100%; box-sizing: border-box;">';
992993
input += '<div class="select-inner">';
993994
input += '<div class="text-container">';
994995
input += '<div class="text">';
@@ -1003,17 +1004,17 @@ window.ConfigurationsView = countlyView.extend({
10031004
input += '<div class="right combo"></div>';
10041005
input += '</div>';
10051006
input += '<div class="select-items square" style="width: 100%;"><div>';
1006-
for (var c in configsData[i]) {
1007-
input += '<div data-value="' + c + '" class="item ' + (configsData[i][c] ? 'selected' : '') + '">' + this.getLabelName((id + "." + c).substring(1), c).text + '</div>';
1007+
for (var d in configsData[i]) {
1008+
input += '<div data-value="' + d + '" class="item ' + (configsData[i][d] ? 'selected' : '') + '">' + this.getLabelName((id + "." + d).substring(1), d).text + '</div>';
10081009
}
10091010
input += '</div></div>';
10101011
input += '</div>';
10111012

10121013
configsHTML += "<tr id='config-row-" + i + "-user-conf' class='config-table-details-row user-row' style='display:none'><td>" + label + "</td><td>" + input + "</td></tr>";
10131014
}
10141015
else {
1015-
var input = this.getInputByType((id + "." + i).substring(1), configsData[i]);
1016-
var label = this.getInputLabel((id + "." + i).substring(1), i);
1016+
input = this.getInputByType((id + "." + i).substring(1), configsData[i]);
1017+
label = this.getInputLabel((id + "." + i).substring(1), i);
10171018
if (input && label) {
10181019
configsHTML += "<tr id='config-row-" + i + "-" + id.replace(".", "") + "' class='config-table-details-row'><td>" + label + "</td><td>" + input + "</td></tr>";
10191020
}
@@ -1241,7 +1242,7 @@ if (countlyGlobal.member.global_admin) {
12411242
this.onChange(name, value);
12421243
}
12431244
},
1244-
beforeRender: function() {
1245+
beforeRender: function() { // eslint-disable-line no-loop-func
12451246
var self = this;
12461247
if (!configManagementPromise) {
12471248
configManagementPromise = $.when(countlyPlugins.initializeConfigs());

plugins/plugins/tests.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1+
/*global describe,it */
12
var request = require('supertest');
2-
var should = require('should');
33
var testUtils = require("../../test/testUtils");
44
request = request(testUtils.url);
55

6-
var APP_KEY = "";
6+
// var APP_KEY = "";
77
var API_KEY_ADMIN = "";
8-
var APP_ID = "";
9-
var DEVICE_ID = "1234567890";
8+
// var APP_ID = "";
9+
// var DEVICE_ID = "1234567890";
1010

1111
describe('Testing Plugins', function() {
1212
it('should have plugin', function(done) {
1313
API_KEY_ADMIN = testUtils.get("API_KEY_ADMIN");
14-
APP_ID = testUtils.get("APP_ID");
15-
APP_KEY = testUtils.get("APP_KEY");
14+
// APP_ID = testUtils.get("APP_ID");
15+
// APP_KEY = testUtils.get("APP_KEY");
1616
request
1717
.get('/o/plugins?api_key=' + API_KEY_ADMIN)
1818
.expect(200)
@@ -26,7 +26,7 @@ describe('Testing Plugins', function() {
2626
ob.should.be.an.instanceOf(Array);
2727
for (var i = 0; i < ob.length; i++) {
2828
ob[i].should.have.property("name");
29-
if (ob[i].name == "countly-plugins") {
29+
if (ob[i].name === "countly-plugins") {
3030
ob[i].should.have.property("title", "Plugins manager");
3131
ob[i].should.have.property("description", "Plugin manager to view and enable/disable plugins");
3232
ob[i].should.have.property("author", "Count.ly");

0 commit comments

Comments
 (0)