Skip to content

Commit 16f97de

Browse files
committed
refactor(schema-compiler): Rename tests for multiple join paths
1 parent 038f19d commit 16f97de

File tree

1 file changed

+23
-34
lines changed

1 file changed

+23
-34
lines changed
Lines changed: 23 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { DataSchemaCompiler } from '../../../src/compiler/DataSchemaCompiler';
44
import { JoinGraph } from '../../../src/compiler/JoinGraph';
55
import { CubeEvaluator } from '../../../src/compiler/CubeEvaluator';
66

7-
describe('View and indirect members', () => {
7+
describe('Multiple join paths', () => {
88
jest.setTimeout(200000);
99

1010
let compiler: DataSchemaCompiler;
@@ -18,9 +18,10 @@ describe('View and indirect members', () => {
1818
// ├-->D-->E---┤
1919
// | |
2020
// └-->F-------┘
21-
// View would use ADEX path
22-
// It should NOT be the shortest one, nor first in join edges declaration
21+
// View, pre-aggregations and all interesting parts should use ADEX path
22+
// It should NOT be the shortest one from A to X (that's AFX), nor first in join edges declaration (that's ABCX)
2323
// All join conditions would be essentially `FALSE`, but with different syntax, to be able to test SQL generation
24+
// Also, there should be only one way to cover cubes A and D with joins: A->D join
2425

2526
// TODO in this model queries like [A.a_id, X.x_id] become ambiguous, probably we want to handle this better
2627

@@ -226,20 +227,6 @@ describe('View and indirect members', () => {
226227
],
227228
prefix: false
228229
},
229-
{
230-
join_path: A.D,
231-
includes: [
232-
'd_id',
233-
],
234-
prefix: false
235-
},
236-
{
237-
join_path: A.D.E,
238-
includes: [
239-
'e_id',
240-
],
241-
prefix: false
242-
},
243230
{
244231
join_path: A.D.E.X,
245232
includes: [
@@ -259,24 +246,26 @@ describe('View and indirect members', () => {
259246
await compiler.compile();
260247
});
261248

262-
it('should respect join path from view declaration', async () => {
263-
const query = new PostgresQuery({ joinGraph, cubeEvaluator, compiler }, {
264-
measures: [],
265-
dimensions: [
266-
'ADEX_view.a_id',
267-
'ADEX_view.x_id_ref',
268-
],
269-
});
249+
describe('View and indirect members', () => {
250+
it('should respect join path from view declaration', async () => {
251+
const query = new PostgresQuery({ joinGraph, cubeEvaluator, compiler }, {
252+
measures: [],
253+
dimensions: [
254+
'ADEX_view.a_id',
255+
'ADEX_view.x_id_ref',
256+
],
257+
});
270258

271-
const [sql, _params] = query.buildSqlAndParams();
259+
const [sql, _params] = query.buildSqlAndParams();
272260

273-
expect(sql).toMatch(/ON 'A' = 'D'/);
274-
expect(sql).toMatch(/ON 'D' = 'E'/);
275-
expect(sql).toMatch(/ON 'E' = 'X'/);
276-
expect(sql).not.toMatch(/ON 'A' = 'B'/);
277-
expect(sql).not.toMatch(/ON 'B' = 'C'/);
278-
expect(sql).not.toMatch(/ON 'C' = 'X'/);
279-
expect(sql).not.toMatch(/ON 'A' = 'F'/);
280-
expect(sql).not.toMatch(/ON 'F' = 'X'/);
261+
expect(sql).toMatch(/ON 'A' = 'D'/);
262+
expect(sql).toMatch(/ON 'D' = 'E'/);
263+
expect(sql).toMatch(/ON 'E' = 'X'/);
264+
expect(sql).not.toMatch(/ON 'A' = 'B'/);
265+
expect(sql).not.toMatch(/ON 'B' = 'C'/);
266+
expect(sql).not.toMatch(/ON 'C' = 'X'/);
267+
expect(sql).not.toMatch(/ON 'A' = 'F'/);
268+
expect(sql).not.toMatch(/ON 'F' = 'X'/);
269+
});
281270
});
282271
});

0 commit comments

Comments
 (0)