From 3ce38d7081e002b28d9edcbf7974f1f7a62d614f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Thu, 18 May 2017 15:49:57 +0200 Subject: [PATCH] Going green: fix type error when no buffersize is defined in mapconfig --- .../mapconfig/adapter/mapconfig-buffer-size-adapter.js | 5 +++++ test/acceptance/buffer-size-format.js | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/cartodb/models/mapconfig/adapter/mapconfig-buffer-size-adapter.js b/lib/cartodb/models/mapconfig/adapter/mapconfig-buffer-size-adapter.js index 3296d0ea..7e9e93a1 100644 --- a/lib/cartodb/models/mapconfig/adapter/mapconfig-buffer-size-adapter.js +++ b/lib/cartodb/models/mapconfig/adapter/mapconfig-buffer-size-adapter.js @@ -9,8 +9,13 @@ MapConfigBufferSizeAdapter.prototype.getMapConfig = function (user, requestMapCo return callback(null, requestMapConfig); } + this.formats.forEach(function (format) { if (Number.isFinite(context.templateParams.buffersize[format])) { + if (requestMapConfig.buffersize === undefined) { + requestMapConfig.buffersize = {}; + } + requestMapConfig.buffersize[format] = context.templateParams.buffersize[format]; } }); diff --git a/test/acceptance/buffer-size-format.js b/test/acceptance/buffer-size-format.js index 15be2e66..c32f62d1 100644 --- a/test/acceptance/buffer-size-format.js +++ b/test/acceptance/buffer-size-format.js @@ -283,7 +283,7 @@ describe('buffer size per format for named maps', function () { }); -describe.only('buffer size per format for named maps w/o placeholders', function () { +describe('buffer size per format for named maps w/o placeholders', function () { var testCases = [ { desc: 'should get png tile using buffer-size 0 overriden by template params', @@ -398,7 +398,8 @@ describe.only('buffer size per format for named maps w/o placeholders', function } }, { - desc: 'should get png tile using buffer-size 0 overriden by template params with no buffersize in mapconfig', + desc: 'should get png tile using buffer-size 0' + + ' overriden by template params with no buffersize in mapconfig', coords: { z: 7, x: 64, y: 48 }, format: 'png', placeholders: {