Timeseries tests: Set timestamps to the start of the aggregations
Also, increase the end of the range check so it includes some data
This commit is contained in:
parent
243e982bd6
commit
088a8b81a6
@ -264,8 +264,8 @@ module.exports = class DateHistogram extends BaseHistogram {
|
|||||||
offset: this._getOffset(override),
|
offset: this._getOffset(override),
|
||||||
timestamp_start: firstRow.timestamp_start,
|
timestamp_start: firstRow.timestamp_start,
|
||||||
|
|
||||||
bin_width: firstRow.bin_width,
|
bin_width: firstRow.bin_width || 0,
|
||||||
bins_count: firstRow.bins_number,
|
bins_count: firstRow.bins_number || 0,
|
||||||
bins_start: firstRow.timestamp,
|
bins_start: firstRow.timestamp,
|
||||||
nulls: firstRow.nulls_count,
|
nulls: firstRow.nulls_count,
|
||||||
infinities: firstRow.infinities_count,
|
infinities: firstRow.infinities_count,
|
||||||
|
@ -186,7 +186,7 @@ describe('histogram-dataview for date column type', function() {
|
|||||||
},
|
},
|
||||||
minute_histogram: {
|
minute_histogram: {
|
||||||
source: {
|
source: {
|
||||||
id: 'minute-histogram-source'
|
id: 'minute-histogram-source-tz'
|
||||||
},
|
},
|
||||||
type: 'histogram',
|
type: 'histogram',
|
||||||
options: {
|
options: {
|
||||||
@ -215,7 +215,7 @@ describe('histogram-dataview for date column type', function() {
|
|||||||
"query": [
|
"query": [
|
||||||
"select null::geometry the_geom_webmercator, date AS d",
|
"select null::geometry the_geom_webmercator, date AS d",
|
||||||
"from generate_series(",
|
"from generate_series(",
|
||||||
"'2007-02-15 01:00:00'::timestamptz, '2008-04-09 01:00:00'::timestamptz, '1 day'::interval",
|
"'2007-02-15 01:00:00+00'::timestamptz, '2008-04-09 01:00:00+00'::timestamptz, '1 day'::interval",
|
||||||
") date"
|
") date"
|
||||||
].join(' ')
|
].join(' ')
|
||||||
}
|
}
|
||||||
@ -233,13 +233,13 @@ describe('histogram-dataview for date column type', function() {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "minute-histogram-source",
|
"id": "minute-histogram-source-tz",
|
||||||
"type": "source",
|
"type": "source",
|
||||||
"params": {
|
"params": {
|
||||||
"query": [
|
"query": [
|
||||||
"select null::geometry the_geom_webmercator, date AS d",
|
"select null::geometry the_geom_webmercator, date AS d",
|
||||||
"from generate_series(",
|
"from generate_series(",
|
||||||
"'2007-02-15 23:50:00'::timestamp, '2007-02-16 00:10:00'::timestamp, '1 minute'::interval",
|
"'2007-02-15 23:50:00+00'::timestamptz, '2007-02-16 00:10:00+00'::timestamptz, '1 minute'::interval",
|
||||||
") date"
|
") date"
|
||||||
].join(' ')
|
].join(' ')
|
||||||
}
|
}
|
||||||
@ -323,7 +323,7 @@ describe('histogram-dataview for date column type', function() {
|
|||||||
assert.ok(!err, err);
|
assert.ok(!err, err);
|
||||||
assert.equal(dataview.type, 'histogram');
|
assert.equal(dataview.type, 'histogram');
|
||||||
assert.ok(dataview.bin_width > 0, 'Unexpected bin width: ' + dataview.bin_width);
|
assert.ok(dataview.bin_width > 0, 'Unexpected bin width: ' + dataview.bin_width);
|
||||||
assert.equal(dataview.bins.length, 6);
|
assert.equal(dataview.bins_count, 6);
|
||||||
dataview.bins.forEach(function (bin) {
|
dataview.bins.forEach(function (bin) {
|
||||||
assert.ok(bin.min <= bin.max, 'bin min < bin max: ' + JSON.stringify(bin));
|
assert.ok(bin.min <= bin.max, 'bin min < bin max: ' + JSON.stringify(bin));
|
||||||
});
|
});
|
||||||
@ -335,7 +335,7 @@ describe('histogram-dataview for date column type', function() {
|
|||||||
it('should cast overridden start and end to float to avoid out of range errors ' + test.desc, function (done) {
|
it('should cast overridden start and end to float to avoid out of range errors ' + test.desc, function (done) {
|
||||||
var params = {
|
var params = {
|
||||||
start: -2145916800,
|
start: -2145916800,
|
||||||
end: 1009843199
|
end: 1193792400
|
||||||
};
|
};
|
||||||
|
|
||||||
this.testClient = new TestClient(mapConfig, 1234);
|
this.testClient = new TestClient(mapConfig, 1234);
|
||||||
@ -640,7 +640,7 @@ describe('histogram-dataview for date column type', function() {
|
|||||||
|
|
||||||
var dataviewWithDailyAggFixture = {
|
var dataviewWithDailyAggFixture = {
|
||||||
aggregation: 'day',
|
aggregation: 'day',
|
||||||
bin_width: 600,
|
bin_width: 86400,
|
||||||
bins_count: 2,
|
bins_count: 2,
|
||||||
bins_start: 1171497600,
|
bins_start: 1171497600,
|
||||||
timestamp_start: 1171497600,
|
timestamp_start: 1171497600,
|
||||||
@ -650,17 +650,17 @@ describe('histogram-dataview for date column type', function() {
|
|||||||
[{
|
[{
|
||||||
bin: 0,
|
bin: 0,
|
||||||
timestamp: 1171497600,
|
timestamp: 1171497600,
|
||||||
min: 1171583400,
|
min: 1171497600,
|
||||||
max: 1171583940,
|
max: 1171497600,
|
||||||
avg: 1171583670,
|
avg: 1171497600,
|
||||||
freq: 10
|
freq: 10
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
bin: 1,
|
bin: 1,
|
||||||
timestamp: 1171584000,
|
timestamp: 1171584000,
|
||||||
min: 1171584000,
|
min: 1171584000,
|
||||||
max: 1171584600,
|
max: 1171584000,
|
||||||
avg: 1171584300,
|
avg: 1171584000,
|
||||||
freq: 11
|
freq: 11
|
||||||
}],
|
}],
|
||||||
type: 'histogram'
|
type: 'histogram'
|
||||||
@ -687,19 +687,19 @@ describe('histogram-dataview for date column type', function() {
|
|||||||
|
|
||||||
var dataviewWithDailyAggAndOffsetFixture = {
|
var dataviewWithDailyAggAndOffsetFixture = {
|
||||||
aggregation: 'day',
|
aggregation: 'day',
|
||||||
bin_width: 1200,
|
bin_width: 86400,
|
||||||
bins_count: 1,
|
bins_count: 1,
|
||||||
bins_start: 1171501200,
|
bins_start: 1171501200,
|
||||||
timestamp_start: 1171497600,
|
timestamp_start: 1171501200,
|
||||||
nulls: 0,
|
nulls: 0,
|
||||||
offset: -3600,
|
offset: -3600,
|
||||||
bins:
|
bins:
|
||||||
[{
|
[{
|
||||||
bin: 0,
|
bin: 0,
|
||||||
timestamp: 1171501200,
|
timestamp: 1171501200,
|
||||||
min: 1171583400,
|
min: 1171501200,
|
||||||
max: 1171584600,
|
max: 1171501200,
|
||||||
avg: 1171584000,
|
avg: 1171501200,
|
||||||
freq: 21
|
freq: 21
|
||||||
}],
|
}],
|
||||||
type: 'histogram'
|
type: 'histogram'
|
||||||
|
Loading…
Reference in New Issue
Block a user