Test for histogram bins beyond limits

This commit is contained in:
Rafa de la Torre 2018-07-04 18:33:02 +02:00
parent 2c334570c3
commit 6411556a97

View File

@ -67,6 +67,27 @@ describe('histogram-dataview', function() {
] ]
); );
it('should get bins with min >= start and max <= end', function(done) {
var params = {
bins: 3,
start: 50,
end: 500
};
this.testClient = new TestClient(mapConfig, 1234);
this.testClient.getDataview('pop_max_histogram', params, function(err, dataview) {
assert.ok(!err, err);
assert.ok(3 === dataview.bins_count, 'Unexpected bin count: ' + dataview.bins_count);
assert.ok(3 === dataview.bins.length, 'Unexpected number of bins: ' + dataview.bins.length);
dataview.bins.forEach(function(bin) {
assert.ok(bin.min >= params.start, 'bin min < start: ' + JSON.stringify(bin));
assert.ok(bin.max <= params.end, 'bin max > end: ' + JSON.stringify(bin));
});
done();
});
});
it('should get bin_width right when max > min in filter', function(done) { it('should get bin_width right when max > min in filter', function(done) {
var params = { var params = {
bins: 10, bins: 10,