From d25e8e97983148751dae81d8d43bfa4c05ba2164 Mon Sep 17 00:00:00 2001 From: Rafa de la Torre Date: Wed, 17 Oct 2018 11:12:58 +0200 Subject: [PATCH] Make the test work in dual mode (mapnik/pgis) --- test/acceptance/tilejson.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/test/acceptance/tilejson.js b/test/acceptance/tilejson.js index 0d3bc133..0230b715 100644 --- a/test/acceptance/tilejson.js +++ b/test/acceptance/tilejson.js @@ -2,8 +2,23 @@ require('../support/test_helper'); const assert = require('../support/assert'); const TestClient = require('../support/test-client'); +const serverOptions = require('../../lib/cartodb/server_options'); -describe('tilejson', function() { +const describe_pg = process.env.POSTGIS_VERSION >= '20400' ? describe : describe.skip; +const originalUsePostGIS = serverOptions.renderer.mvt.usePostGIS; + +describe('tilejson via mapnik renderer', () => { tileJsonSuite(false); }); +describe_pg('tilejson via postgis renderer', () => { tileJsonSuite(true); }); + +function tileJsonSuite(usePostGIS) { + + before(function() { + serverOptions.renderer.mvt.usePostGIS = usePostGIS; + }); + + after(function () { + serverOptions.renderer.mvt.usePostGIS = originalUsePostGIS; + }); function tilejsonValidation(tilejson, shouldHaveGrid = false) { assert.equal(tilejson.tilejson, '2.2.0'); @@ -215,5 +230,4 @@ describe('tilejson', function() { }); }); - -}); +}