2018-10-24 00:39:02 +08:00
|
|
|
'use strict';
|
|
|
|
|
2017-05-18 02:16:43 +08:00
|
|
|
var assert = require('assert');
|
2019-10-07 17:29:07 +08:00
|
|
|
var TorqueLayerStats = require('../../../../lib/backends/layer-stats/torque-layer-stats');
|
2017-05-18 02:16:43 +08:00
|
|
|
var MapConfig = require('windshaft').model.MapConfig;
|
|
|
|
|
|
|
|
describe('torque-layer-stats', function () {
|
|
|
|
beforeEach(function () {
|
|
|
|
this.params = {};
|
|
|
|
});
|
|
|
|
|
|
|
|
var testMapConfigOneLayer = {
|
|
|
|
version: '1.5.0',
|
|
|
|
layers: [
|
|
|
|
{
|
|
|
|
type: 'torque',
|
|
|
|
options: {
|
|
|
|
sql: 'select * from test_table limit 2',
|
|
|
|
cartocss: '#layer { marker-fill:red; marker-width:32; marker-allow-overlap:true; }',
|
2019-10-22 01:07:24 +08:00
|
|
|
cartocss_version: '2.3.0'
|
2017-05-18 02:16:43 +08:00
|
|
|
}
|
2019-10-22 01:07:24 +08:00
|
|
|
}
|
2017-05-18 02:16:43 +08:00
|
|
|
]
|
|
|
|
};
|
|
|
|
|
2019-10-22 01:07:24 +08:00
|
|
|
it('should return torque stats for one layer', function (done) {
|
2017-05-18 02:16:43 +08:00
|
|
|
var mapConfig = MapConfig.create(testMapConfigOneLayer);
|
|
|
|
var layerId = 0;
|
|
|
|
var layer = mapConfig.getLayer(layerId);
|
|
|
|
var testSubject = new TorqueLayerStats();
|
|
|
|
testSubject.getStats(layer, {}, function (err, result) {
|
|
|
|
assert.ifError(err);
|
|
|
|
assert.deepEqual({}, result);
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|