Make the test work in dual mode (mapnik/pgis)

This commit is contained in:
Rafa de la Torre
2018-10-17 17:35:36 +02:00
parent bfbd9a8f22
commit d25e8e9798
+17 -3
View File
@@ -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() {
});
});
});
}