Several jshint fixes
This commit is contained in:
parent
664892bba9
commit
5d750f3b98
@ -22,7 +22,7 @@ const MAPNIK_SUPPORTED_FORMATS = {
|
|||||||
'grid.json': true,
|
'grid.json': true,
|
||||||
'geojson': true,
|
'geojson': true,
|
||||||
'mvt': true
|
'mvt': true
|
||||||
}
|
};
|
||||||
|
|
||||||
function TestClient(config, apiKey) {
|
function TestClient(config, apiKey) {
|
||||||
this.mapConfig = isMapConfig(config) ? config : null;
|
this.mapConfig = isMapConfig(config) ? config : null;
|
||||||
@ -115,7 +115,7 @@ module.exports.CARTOCSS = {
|
|||||||
module.exports.SQL = {
|
module.exports.SQL = {
|
||||||
EMPTY: 'select 1 as cartodb_id, null::geometry as the_geom_webmercator',
|
EMPTY: 'select 1 as cartodb_id, null::geometry as the_geom_webmercator',
|
||||||
ONE_POINT: 'select 1 as cartodb_id, \'SRID=3857;POINT(0 0)\'::geometry the_geom_webmercator'
|
ONE_POINT: 'select 1 as cartodb_id, \'SRID=3857;POINT(0 0)\'::geometry the_geom_webmercator'
|
||||||
}
|
};
|
||||||
|
|
||||||
TestClient.prototype.getWidget = function(widgetName, params, callback) {
|
TestClient.prototype.getWidget = function(widgetName, params, callback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
@ -479,7 +479,6 @@ TestClient.prototype.getFeatureAttributes = function(featureId, layerId, params,
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var layergroupId;
|
|
||||||
step(
|
step(
|
||||||
function createLayergroup() {
|
function createLayergroup() {
|
||||||
var next = this;
|
var next = this;
|
||||||
@ -568,7 +567,7 @@ TestClient.prototype.getTile = function(z, x, y, params, callback) {
|
|||||||
var layergroupId;
|
var layergroupId;
|
||||||
|
|
||||||
if (params.layergroupid) {
|
if (params.layergroupid) {
|
||||||
layergroupId = params.layergroupid
|
layergroupId = params.layergroupid;
|
||||||
}
|
}
|
||||||
|
|
||||||
step(
|
step(
|
||||||
@ -583,7 +582,7 @@ TestClient.prototype.getTile = function(z, x, y, params, callback) {
|
|||||||
return next(new Error('apiKey param is mandatory to create a new template'));
|
return next(new Error('apiKey param is mandatory to create a new template'));
|
||||||
}
|
}
|
||||||
|
|
||||||
params.placeholders = params.placeholders || {};
|
params.placeholders = params.placeholders || {};
|
||||||
|
|
||||||
assert.response(self.server,
|
assert.response(self.server,
|
||||||
{
|
{
|
||||||
@ -616,7 +615,7 @@ TestClient.prototype.getTile = function(z, x, y, params, callback) {
|
|||||||
return next(null, layergroupId);
|
return next(null, layergroupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
var data = templateId ? params.placeholders : self.mapConfig
|
var data = templateId ? params.placeholders : self.mapConfig;
|
||||||
var path = templateId ?
|
var path = templateId ?
|
||||||
urlNamed + '/' + templateId + '?' + qs.stringify({api_key: self.apiKey}) :
|
urlNamed + '/' + templateId + '?' + qs.stringify({api_key: self.apiKey}) :
|
||||||
url;
|
url;
|
||||||
@ -646,6 +645,7 @@ TestClient.prototype.getTile = function(z, x, y, params, callback) {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
function getTileResult(err, _layergroupId) {
|
function getTileResult(err, _layergroupId) {
|
||||||
|
// jshint maxcomplexity:12
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
|
|
||||||
layergroupId = _layergroupId;
|
layergroupId = _layergroupId;
|
||||||
@ -744,7 +744,7 @@ TestClient.prototype.getTile = function(z, x, y, params, callback) {
|
|||||||
body = JSON.parse(res.body);
|
body = JSON.parse(res.body);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
body = res.body
|
body = res.body;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -784,10 +784,11 @@ TestClient.prototype.getLayergroup = function(expectedResponse, callback) {
|
|||||||
},
|
},
|
||||||
expectedResponse,
|
expectedResponse,
|
||||||
function(res, err) {
|
function(res, err) {
|
||||||
|
var parsedBody;
|
||||||
// If there is a response, we are still interested in catching the created keys
|
// If there is a response, we are still interested in catching the created keys
|
||||||
// to be able to delete them on the .drain() method.
|
// to be able to delete them on the .drain() method.
|
||||||
if (res) {
|
if (res) {
|
||||||
var parsedBody = JSON.parse(res.body);
|
parsedBody = JSON.parse(res.body);
|
||||||
if (parsedBody.layergroupid) {
|
if (parsedBody.layergroupid) {
|
||||||
self.keysToDelete['map_cfg|' + LayergroupToken.parse(parsedBody.layergroupid).token] = 0;
|
self.keysToDelete['map_cfg|' + LayergroupToken.parse(parsedBody.layergroupid).token] = 0;
|
||||||
self.keysToDelete['user:localhost:mapviews:global'] = 5;
|
self.keysToDelete['user:localhost:mapviews:global'] = 5;
|
||||||
@ -805,7 +806,7 @@ TestClient.prototype.getLayergroup = function(expectedResponse, callback) {
|
|||||||
TestClient.prototype.getStaticCenter = function (params, callback) {
|
TestClient.prototype.getStaticCenter = function (params, callback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
let { layergroupid, z, lat, lng, width, height, format } = params
|
let { layergroupid, z, lat, lng, width, height, format } = params;
|
||||||
|
|
||||||
var url = `/api/v1/map/`;
|
var url = `/api/v1/map/`;
|
||||||
|
|
||||||
@ -821,7 +822,7 @@ TestClient.prototype.getStaticCenter = function (params, callback) {
|
|||||||
return next(null, layergroupid);
|
return next(null, layergroupid);
|
||||||
}
|
}
|
||||||
|
|
||||||
var data = self.mapConfig
|
var data = self.mapConfig;
|
||||||
var path = url;
|
var path = url;
|
||||||
|
|
||||||
assert.response(self.server,
|
assert.response(self.server,
|
||||||
@ -851,13 +852,11 @@ TestClient.prototype.getStaticCenter = function (params, callback) {
|
|||||||
function getStaticResult(err, _layergroupid) {
|
function getStaticResult(err, _layergroupid) {
|
||||||
assert.ifError(err);
|
assert.ifError(err);
|
||||||
|
|
||||||
var next = this;
|
|
||||||
|
|
||||||
layergroupid = _layergroupid;
|
layergroupid = _layergroupid;
|
||||||
self.keysToDelete['map_cfg|' + LayergroupToken.parse(layergroupid).token] = 0;
|
self.keysToDelete['map_cfg|' + LayergroupToken.parse(layergroupid).token] = 0;
|
||||||
self.keysToDelete['user:localhost:mapviews:global'] = 5;
|
self.keysToDelete['user:localhost:mapviews:global'] = 5;
|
||||||
|
|
||||||
url = `/api/v1/map/static/center/${layergroupid}/${z}/${lat}/${lng}/${width}/${height}.${format}`
|
url = `/api/v1/map/static/center/${layergroupid}/${z}/${lat}/${lng}/${width}/${height}.${format}`;
|
||||||
|
|
||||||
if (self.apiKey) {
|
if (self.apiKey) {
|
||||||
url += '?' + qs.stringify({api_key: self.apiKey});
|
url += '?' + qs.stringify({api_key: self.apiKey});
|
||||||
@ -895,7 +894,7 @@ TestClient.prototype.getStaticCenter = function (params, callback) {
|
|||||||
body = JSON.parse(res.body);
|
body = JSON.parse(res.body);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
body = res.body
|
body = res.body;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -995,11 +994,11 @@ TestClient.prototype.getAttributes = function(params, callback) {
|
|||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
if (!Number.isFinite(params.featureId)) {
|
if (!Number.isFinite(params.featureId)) {
|
||||||
throw new Error('featureId param must be a number')
|
throw new Error('featureId param must be a number');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Number.isFinite(params.layer)) {
|
if (!Number.isFinite(params.layer)) {
|
||||||
throw new Error('layer param must be a number')
|
throw new Error('layer param must be a number');
|
||||||
}
|
}
|
||||||
|
|
||||||
var url = '/api/v1/map';
|
var url = '/api/v1/map';
|
||||||
@ -1011,7 +1010,7 @@ TestClient.prototype.getAttributes = function(params, callback) {
|
|||||||
var layergroupid;
|
var layergroupid;
|
||||||
|
|
||||||
if (params.layergroupid) {
|
if (params.layergroupid) {
|
||||||
layergroupid = params.layergroupid
|
layergroupid = params.layergroupid;
|
||||||
}
|
}
|
||||||
|
|
||||||
step(
|
step(
|
||||||
@ -1149,12 +1148,11 @@ TestClient.prototype.setUserRenderTimeoutLimit = function (user, userTimeoutLimi
|
|||||||
|
|
||||||
TestClient.prototype.setUserDatabaseTimeoutLimit = function (timeoutLimit, callback) {
|
TestClient.prototype.setUserDatabaseTimeoutLimit = function (timeoutLimit, callback) {
|
||||||
const dbname = _.template(global.environment.postgres_auth_user, { user_id: 1 }) + '_db';
|
const dbname = _.template(global.environment.postgres_auth_user, { user_id: 1 }) + '_db';
|
||||||
const dbuser = _.template(global.environment.postgres_auth_user, { user_id: 1 })
|
const dbuser = _.template(global.environment.postgres_auth_user, { user_id: 1 });
|
||||||
const pass = _.template(global.environment.postgres_auth_pass, { user_id: 1 })
|
|
||||||
const publicuser = global.environment.postgres.user;
|
const publicuser = global.environment.postgres.user;
|
||||||
|
|
||||||
// we need to guarantee all new connections have the new settings
|
// we need to guarantee all new connections have the new settings
|
||||||
helper.cleanPGPoolConnections()
|
helper.cleanPGPoolConnections();
|
||||||
|
|
||||||
const psql = new PSQL({
|
const psql = new PSQL({
|
||||||
user: 'postgres',
|
user: 'postgres',
|
||||||
|
Loading…
Reference in New Issue
Block a user