diff --git a/test/acceptance/aggregation.js b/test/acceptance/aggregation.js index 4978b920..1c76165d 100644 --- a/test/acceptance/aggregation.js +++ b/test/acceptance/aggregation.js @@ -92,6 +92,14 @@ describe('aggregation', function () { } `; + const POINTS_SQL_ONLY_WEBMERCATOR = ` + select + x + 4 as cartodb_id, + st_transform(st_setsrid(st_makepoint(x*10, x*10), 4326), 3857) as the_geom_webmercator, + x as value + from generate_series(-3, 3) x + `; + function createVectorMapConfig (layers = [ { type: 'cartodb', @@ -1401,6 +1409,35 @@ describe('aggregation', function () { }); }); }); + + it('should only require the_geom_webmercator for aggregation', function (done) { + this.mapConfig = createVectorMapConfig([ + { + type: 'cartodb', + options: { + sql: POINTS_SQL_ONLY_WEBMERCATOR, + aggregation: { + threshold: 1 + } + } + } + ]); + this.testClient = new TestClient(this.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)); + body.metadata.layers.forEach(layer => assert.ok(!layer.meta.aggregation.png)); + + done(); + }); + }); }); }); });