Skip to content

Commit a648544

Browse files
committed
Add more tests
1 parent c4223ad commit a648544

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

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

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1201,7 +1201,7 @@ describe('PreAggregations', () => {
12011201
});
12021202
});
12031203

1204-
it('non-match because of join tree difference', async () => {
1204+
it('non-match because of join tree difference (through the view)', async () => {
12051205
await compiler.compile();
12061206
const query = new PostgresQuery({ joinGraph, cubeEvaluator, compiler }, {
12071207
measures: [
@@ -1259,6 +1259,33 @@ describe('PreAggregations', () => {
12591259
});
12601260
});
12611261

1262+
it('non-match because of requesting only joined cube members', async () => {
1263+
await compiler.compile();
1264+
const query = new PostgresQuery({ joinGraph, cubeEvaluator, compiler }, {
1265+
dimensions: ['visitor_checkins.source'],
1266+
order: [{
1267+
id: 'visitor_checkins.source'
1268+
}],
1269+
timezone: 'America/Los_Angeles',
1270+
preAggregationsSchema: ''
1271+
});
1272+
1273+
const queryAndParams = query.buildSqlAndParams();
1274+
console.log(queryAndParams);
1275+
expect((<any>query).preAggregations.preAggregationForQuery).toBeUndefined();
1276+
1277+
return dbRunner.evaluateQueryWithPreAggregations(query).then(res => {
1278+
expect(res).toEqual([
1279+
{
1280+
vc__source: 'google',
1281+
},
1282+
{
1283+
vc__source: null,
1284+
},
1285+
]);
1286+
});
1287+
});
1288+
12621289
it('non-leaf additive measure', async () => {
12631290
await compiler.compile();
12641291

0 commit comments

Comments
 (0)