From d8202d881d37fd71ff4851fc2dc3d95da33a819d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Thu, 8 Mar 2018 12:46:04 +0100 Subject: [PATCH] Remove legacy test --- test/unit/cartodb/ported/tile_stats.test.js | 90 --------------------- 1 file changed, 90 deletions(-) delete mode 100644 test/unit/cartodb/ported/tile_stats.test.js diff --git a/test/unit/cartodb/ported/tile_stats.test.js b/test/unit/cartodb/ported/tile_stats.test.js deleted file mode 100644 index f8e0d80a..00000000 --- a/test/unit/cartodb/ported/tile_stats.test.js +++ /dev/null @@ -1,90 +0,0 @@ -require('../../../support/test_helper.js'); - -var assert = require('assert'); - -var LayergroupController = require('../../../../lib/cartodb/controllers/layergroup'); - -describe('tile stats', function() { - - beforeEach(function () { - this.statsClient = global.statsClient; - }); - - afterEach(function() { - global.statsClient = this.statsClient; - }); - - it.skip('finalizeGetTileOrGrid does not call statsClient when format is not supported', function() { - var expectedCalls = 2, // it will call increment once for the general error - invalidFormat = 'png2', - invalidFormatRegexp = new RegExp('invalid'), - formatMatched = false; - mockStatsClientGetInstance({ - increment: function(label) { - formatMatched = formatMatched || !!label.match(invalidFormatRegexp); - expectedCalls--; - } - }); - - var layergroupController = new LayergroupController(); - - var reqMock = { - profiler: { toJSONString:function() {} }, - params: { - format: invalidFormat - } - }; - var resMock = { - status: function() { return this; }, - set: function() {}, - json: function() {}, - jsonp: function() {}, - send: function() {} - }; - - var next = function () {}; - layergroupController.finalizeGetTileOrGrid('Unsupported format png2', reqMock, resMock, null, null, next); - - assert.ok(formatMatched, 'Format was never matched in increment method'); - assert.equal(expectedCalls, 0, 'Unexpected number of calls to increment method'); - }); - - it.skip('finalizeGetTileOrGrid calls statsClient when format is supported', function() { - var expectedCalls = 2, // general error + format error - validFormat = 'png', - validFormatRegexp = new RegExp(validFormat), - formatMatched = false; - mockStatsClientGetInstance({ - increment: function(label) { - formatMatched = formatMatched || !!label.match(validFormatRegexp); - expectedCalls--; - } - }); - var reqMock = { - profiler: { toJSONString:function() {} }, - params: { - format: validFormat - } - }; - var resMock = { - status: function() { return this; }, - set: function() {}, - json: function() {}, - jsonp: function() {}, - send: function() {} - }; - - var layergroupController = new LayergroupController(); - - var next = function () {}; - layergroupController.finalizeGetTileOrGrid('Another error happened', reqMock, resMock, null, null, next); - - assert.ok(formatMatched, 'Format was never matched in increment method'); - assert.equal(expectedCalls, 0, 'Unexpected number of calls to increment method'); - }); - - function mockStatsClientGetInstance(instance) { - global.statsClient = Object.assign(global.statsClient, instance); - } - -});