Merge branch 'master' into use-strict
This commit is contained in:
commit
ca7acb8339
@ -60,6 +60,9 @@ jobs:
|
||||
- createuser publicuser
|
||||
- psql -c "CREATE EXTENSION postgis" template_postgis
|
||||
|
||||
- psql -c "select version();" template_postgis
|
||||
- psql -c "select postgis_version();" template_postgis
|
||||
|
||||
# install yarn 0.27.5
|
||||
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 0.27.5
|
||||
- export PATH="$HOME/.yarn/bin:$PATH"
|
||||
|
@ -73,7 +73,7 @@ function _geometryType(ctx) {
|
||||
const geometryColumn = AggregationMapConfig.getAggregationGeometryColumn();
|
||||
const sqlQuery = _getSQL(ctx, sql => queryUtils.getQueryGeometryType(sql, geometryColumn));
|
||||
return queryUtils.queryPromise(ctx.dbConnection, sqlQuery)
|
||||
.then(res => ({ geometryType: res.rows[0].geom_type }));
|
||||
.then(res => ({ geometryType: (res.rows[0] || {}).geom_type }));
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ function serverInstance(options) {
|
||||
return otherServer;
|
||||
}
|
||||
|
||||
return server;
|
||||
return getServer();
|
||||
}
|
||||
|
||||
function layergroupRequest(layergroupConfig, method, callbackName, extraParams) {
|
||||
|
@ -4,14 +4,32 @@ require('../../support/test_helper');
|
||||
|
||||
var assert = require('../../support/assert');
|
||||
var TestClient = require('../../support/test-client');
|
||||
const serverOptions = require('../../../lib/cartodb/server_options');
|
||||
|
||||
const suites = [{
|
||||
desc: 'mvt (mapnik)',
|
||||
usePostGIS: false
|
||||
}];
|
||||
|
||||
if (process.env.POSTGIS_VERSION >= '20400') {
|
||||
suites.push({
|
||||
desc: 'mvt (postgis)',
|
||||
usePostGIS: true
|
||||
});
|
||||
}
|
||||
|
||||
suites.forEach(({desc, usePostGIS}) => {
|
||||
describe(`[${desc}] Create mapnik layergroup`, function() {
|
||||
const originalUsePostGIS = serverOptions.renderer.mvt.usePostGIS;
|
||||
|
||||
describe('Create mapnik layergroup', function() {
|
||||
before(function() {
|
||||
serverOptions.renderer.mvt.usePostGIS = usePostGIS;
|
||||
this.layerStatsConfig = global.environment.enabledFeatures.layerStats;
|
||||
global.environment.enabledFeatures.layerStats = true;
|
||||
});
|
||||
|
||||
after(function() {
|
||||
serverOptions.renderer.mvt.usePostGIS = originalUsePostGIS;
|
||||
global.environment.enabledFeatures.layerStats = this.layerStatsConfig;
|
||||
});
|
||||
|
||||
@ -521,6 +539,30 @@ describe('Create mapnik layergroup', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it(`should not fail "TypeError: ... 'geom_type' of undefined" for empty results`, function(done) {
|
||||
var testClient = new TestClient({
|
||||
version: '1.8.0',
|
||||
layers: [
|
||||
{
|
||||
type: 'mapnik',
|
||||
options: {
|
||||
sql: 'select * from test_table where false',
|
||||
metadata: {
|
||||
geometryType: true
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
testClient.getLayergroup(function(err, layergroup) {
|
||||
assert.ifError(err);
|
||||
assert.equal(layergroup.metadata.layers[0].id, mapnikBasicLayerId(0));
|
||||
assert.equal(layergroup.metadata.layers[0].meta.stats.geometryType, undefined);
|
||||
testClient.drain(done);
|
||||
});
|
||||
});
|
||||
|
||||
it('should provide a sample as optional metadata', function(done) {
|
||||
var testClient = new TestClient({
|
||||
version: '1.4.0',
|
||||
@ -591,3 +633,4 @@ describe('Create mapnik layergroup', function() {
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user