From 5bc1903677edae6e5c8edcfb8eb5aed2e41f5c8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Tue, 12 Dec 2017 12:15:13 +0100 Subject: [PATCH] Add test to check if cartoccs and aggregation definition are fully compatible --- test/acceptance/aggregation.js | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/test/acceptance/aggregation.js b/test/acceptance/aggregation.js index 804610ba..ef06b1bd 100644 --- a/test/acceptance/aggregation.js +++ b/test/acceptance/aggregation.js @@ -165,6 +165,46 @@ describe('aggregation', function () { }); }); + it('should fail when aggregation and cartocss are not compatible', function (done) { + const response = { + status: 400, + headers: { + 'Content-Type': 'application/json; charset=utf-8' + } + }; + + this.mapConfig = createVectorMapConfig([ + { + type: 'cartodb', + options: { + sql: POINTS_SQL_1, + aggregation: { + columns: { + total: { + aggregate_function: 'sum', + aggregated_column: 'value' + } + }, + threshold: 1 + }, + cartocss: '#layer { marker-width: [value]; }', + cartocss_version: '2.3.0' + } + } + ]); + + this.testClient = new TestClient(this.mapConfig); + this.testClient.getLayergroup({ response }, (err, body) => { + if (err) { + return done(err); + } + + assert.equal(body.errors[0], MISSING_AGGREGATION_COLUMNS); + + done(); + }); + }); + it('should fail if cartocss uses "value" column and it\'s not defined in the aggregation', function (done) { const response = {