From f9a8b3c827886c3c8075f47f6e2ade2d5738ccdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Mon, 15 Oct 2018 08:23:39 +0200 Subject: [PATCH] Add acceptance test --- test/acceptance/mvt.js | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/test/acceptance/mvt.js b/test/acceptance/mvt.js index 5570fdd5..4d447a6a 100644 --- a/test/acceptance/mvt.js +++ b/test/acceptance/mvt.js @@ -239,6 +239,46 @@ return function () { testClient.drain(done); }); }); + + it('two layers, first should use overviews, second shouldn\'t', function (done) { + const mapConfig = createMapConfig( + [ + { + "type": "cartodb", + "options": { + "sql": 'SELECT * FROM test_table_overviews', + "cartocss": TestClient.CARTOCSS.POINTS, + "cartocss_version": "2.3.0" + } + }, + { + "type": "cartodb", + "options": { + "sql": 'SELECT * FROM test_table', + "cartocss": TestClient.CARTOCSS.POINTS, + "cartocss_version": "2.3.0" + } + } + ] + ); + + var testClient = new TestClient(mapConfig); + + testClient.getTile(0, 0, 0, { format: 'mvt' }, function (err, res, mvt) { + assert.ifError(err); + + const tileWithOverviews = JSON.parse(mvt.toGeoJSONSync(0)); + const tileWithoutOverviews = JSON.parse(mvt.toGeoJSONSync(1)); + + assert.ok(Array.isArray(tileWithOverviews.features)); + assert.equal(tileWithOverviews.features.length, 1); + + assert.ok(Array.isArray(tileWithoutOverviews.features)); + assert.equal(tileWithoutOverviews.features.length, 5); + + testClient.drain(done); + }); + }); }); }; }