From 8491b86c1754293d29b18ea519b5a757027430da Mon Sep 17 00:00:00 2001 From: Rafa de la Torre Date: Wed, 17 Oct 2018 10:08:55 +0200 Subject: [PATCH] Extract test generation function --- test/acceptance/buffer-size-format.js | 39 ++++++++++++++------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/test/acceptance/buffer-size-format.js b/test/acceptance/buffer-size-format.js index 0fd8d800..705992dc 100644 --- a/test/acceptance/buffer-size-format.js +++ b/test/acceptance/buffer-size-format.js @@ -139,39 +139,40 @@ describe('buffer size per format', function () { serverOptions.renderer.mvt.usePostGIS = originalUsePostGIS; }); - testCases.forEach(function (test) { - var testFn = () => { - it(test.desc, function (done) { - testClient = new TestClient(test.mapConfig, 1234); - var coords = test.coords; - var options = { - format: test.format, - layers: test.layers - }; - testClient.getTile(coords.z, coords.x, coords.y, options, function (err, res, tile) { - assert.ifError(err); - // To generate images use: - // tile.save(test.fixturePath); - test.assert(tile, done); - }); + var testFn = (test) => { + it(test.desc, function (done) { + testClient = new TestClient(test.mapConfig, 1234); + var coords = test.coords; + var options = { + format: test.format, + layers: test.layers + }; + testClient.getTile(coords.z, coords.x, coords.y, options, function (err, res, tile) { + assert.ifError(err); + // To generate images use: + // tile.save(test.fixturePath); + test.assert(tile, done); }); - }; + }); + }; + + testCases.forEach(function (test) { if (test.format === 'mvt') { const describe_pg = process.env.POSTGIS_VERSION >= '20400' ? describe : describe.skip; describe('using mapnik mvt renderer', function() { before(function () { serverOptions.renderer.mvt.usePostGIS = false; }); - testFn(); + testFn(test); }); describe_pg('using postgis mvt renderer', function() { before(function () { serverOptions.renderer.mvt.usePostGIS = true; }); - testFn(); + testFn(test); }); } else { - testFn(); + testFn(test); } }); });