Cast to integer before comparing cache headers

This commit is contained in:
Daniel García Aubert 2018-05-28 10:31:48 +02:00
parent 4a8bfcf647
commit 4861d35628

View File

@ -51,19 +51,19 @@ describe('server_gettile', function() {
var mapConfig = testClient.defaultTableMapConfig('test_table');
testClient.withLayergroup(mapConfig, function (err, requestTile, finish) {
requestTile(tileUrl, function (err, res) {
var xwc = res.headers['x-windshaft-cache'];
var xwc = parseInt(res.headers['x-windshaft-cache'], 10);
assert.ok(xwc);
assert.ok(xwc > 0);
lastXwc = xwc;
requestTile(tileUrl, function (err, res) {
var xwc = res.headers['x-windshaft-cache'];
var xwc = parseInt(res.headers['x-windshaft-cache'], 10);
assert.ok(xwc);
assert.ok(xwc > 0);
assert.ok(xwc >= lastXwc, `xwc: ${xwc}, lastXwc: ${lastXwc}`);
assert.ok(xwc >= lastXwc);
requestTile(tileUrl, { cache_buster: 'wadus' }, function (err, res) {
var xwc = res.headers['x-windshaft-cache'];
var xwc = parseInt(res.headers['x-windshaft-cache'], 10);
assert.ok(!xwc);
finish(done);
@ -103,7 +103,7 @@ describe('server_gettile', function() {
testClient.withLayergroup(mapConfig, validateLayergroup, function(err, requestTile, finish) {
requestTile(tileUrl, function(err, res) {
var xwc = res.headers['x-windshaft-cache'];
var xwc = parseInt(res.headers['x-windshaft-cache'], 10);
assert.ok(!xwc);
requestTile(tileUrl, function (err, res) {
@ -111,7 +111,7 @@ describe('server_gettile', function() {
res.headers.hasOwnProperty('x-windshaft-cache'),
"Did not hit renderer cache on second time"
);
assert.ok(res.headers['x-windshaft-cache'] >= 0);
assert.ok(parseInt(res.headers['x-windshaft-cache'], 10) >= 0);
assert.imageBufferIsSimilarToFile(res.body, imageFixture, IMAGE_EQUALS_TOLERANCE_PER_MIL,
function(err) {