Going green: fix type error when no buffersize is defined in mapconfig

This commit is contained in:
Daniel García Aubert 2017-05-18 15:49:57 +02:00
parent e9112da305
commit 3ce38d7081
2 changed files with 8 additions and 2 deletions

View File

@ -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];
}
});

View File

@ -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: {