Skip to content

Commit aabc5ab

Browse files
committed
fix test for pre-agg with allowNonStrictDateRangeMatch: true
1 parent 4382d9c commit aabc5ab

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

packages/cubejs-schema-compiler/test/integration/postgres/pre-aggregations.test.ts

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -547,14 +547,15 @@ describe('PreAggregations', () => {
547547
});
548548
}));
549549

550-
it('simple pre-aggregation (with no granularity in query)', () => compiler.compile().then(() => {
550+
it('simple pre-aggregation (allowNonStrictDateRangeMatch: true)', () => compiler.compile().then(() => {
551551
const query = new PostgresQuery({ joinGraph, cubeEvaluator, compiler }, {
552552
measures: [
553553
'visitors.count'
554554
],
555555
timeDimensions: [{
556556
dimension: 'visitors.createdAt',
557-
dateRange: ['2017-01-01 00:00:00.000', '2017-01-29 22:59:59.999']
557+
dateRange: ['2017-01-01 00:10:00.000', '2017-01-29 22:59:59.999'],
558+
granularity: 'hour',
558559
}],
559560
timezone: 'America/Los_Angeles',
560561
preAggregationsSchema: ''
@@ -567,9 +568,24 @@ describe('PreAggregations', () => {
567568

568569
return dbRunner.evaluateQueryWithPreAggregations(query).then(res => {
569570
expect(res).toEqual(
570-
[{
571-
visitors__count: '5'
572-
}]
571+
[
572+
{
573+
visitors__count: '1',
574+
visitors__created_at_hour: '2017-01-02T16:00:00.000Z',
575+
},
576+
{
577+
visitors__count: '1',
578+
visitors__created_at_hour: '2017-01-04T16:00:00.000Z',
579+
},
580+
{
581+
visitors__count: '1',
582+
visitors__created_at_hour: '2017-01-05T16:00:00.000Z',
583+
},
584+
{
585+
visitors__count: '2',
586+
visitors__created_at_hour: '2017-01-06T16:00:00.000Z',
587+
},
588+
]
573589
);
574590
});
575591
}));

0 commit comments

Comments
 (0)