Windshaft-cartodb/test/acceptance/mvt-regressions.js

79 lines
2.5 KiB
JavaScript
Raw Normal View History

require('../support/test_helper');
const assert = require('../support/assert');
const TestClient = require('../support/test-client');
const serverOptions = require('../../lib/cartodb/server_options');
const suites = [{
2018-04-11 22:08:18 +08:00
desc: 'mapnik',
usePostGIS: false
}];
if (process.env.POSTGIS_VERSION === '2.4') {
suites.push({
2018-04-11 22:08:18 +08:00
desc: 'postgis',
usePostGIS: true
});
}
2018-04-11 22:08:18 +08:00
describe('mvt regressions', function () {
suites.forEach((suite) => {
const { desc, usePostGIS } = suite;
describe(desc, function () {
const originalUsePostGIS = serverOptions.renderer.mvt.usePostGIS;
before(function () {
serverOptions.renderer.mvt.usePostGIS = usePostGIS;
});
after(function (){
serverOptions.renderer.mvt.usePostGIS = originalUsePostGIS;
});
afterEach(function (done) {
this.testClient.drain(done);
});
2018-04-11 22:08:18 +08:00
it('should not error on missing column from aggregation', function (done) {
const mapConfig = {
version: '1.7.0',
layers: [
{
type: 'cartodb',
options: {
sql: 'select * from populated_places_simple_reduced',
aggregation: {
placement: 'point-sample',
columns: {
pop_max_avg: {
aggregate_function: 'avg',
aggregated_column: 'pop_max'
}
},
threshold: 1
}
}
}
]
};
this.testClient = new TestClient(mapConfig);
this.testClient.getLayergroup((err, body) => {
if (err) {
return done(err);
}
assert.equal(typeof body.metadata, 'object');
assert.ok(Array.isArray(body.metadata.layers));
body.metadata.layers.forEach(layer => assert.ok(layer.meta.aggregation.mvt));
done();
});
});
});
});
});