Skip to content

Commit 6c12dba

Browse files
committed
fix/update snapshots for schema tests
1 parent 2f0d63a commit 6c12dba

File tree

2 files changed

+72
-44
lines changed

2 files changed

+72
-44
lines changed

packages/cubejs-schema-compiler/test/unit/__snapshots__/schema.test.ts.snap

Lines changed: 71 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ Object {
166166
},
167167
"fileName": "custom_calendar.js",
168168
"hierarchies": Object {},
169-
"joins": Object {},
169+
"joins": Array [],
170170
"measures": Object {
171171
"count": Object {
172172
"ownedByCube": true,
@@ -385,7 +385,7 @@ Object {
385385
"title": "Retail Calendar Hierarchy",
386386
},
387387
},
388-
"joins": Object {},
388+
"joins": Array [],
389389
"measures": Object {
390390
"count": Object {
391391
"ownedByCube": true,
@@ -585,25 +585,28 @@ Object {
585585
`;
586586

587587
exports[`Schema Testing Inheritance CubeB.js correctly extends cubeA.js (with additions): joins 1`] = `
588-
Object {
589-
"order_users": Object {
588+
Array [
589+
Object {
590+
"name": "order_users",
590591
"relationship": "belongsTo",
591592
"sql": [Function],
592593
},
593-
}
594+
]
594595
`;
595596

596597
exports[`Schema Testing Inheritance CubeB.js correctly extends cubeA.js (with additions): joins 2`] = `
597-
Object {
598-
"line_items": Object {
599-
"relationship": "hasMany",
598+
Array [
599+
Object {
600+
"name": "order_users",
601+
"relationship": "belongsTo",
600602
"sql": [Function],
601603
},
602-
"order_users": Object {
603-
"relationship": "belongsTo",
604+
Object {
605+
"name": "line_items",
606+
"relationship": "hasMany",
604607
"sql": [Function],
605608
},
606-
}
609+
]
607610
`;
608611

609612
exports[`Schema Testing Inheritance CubeB.js correctly extends cubeA.js (with additions): measures 1`] = `
@@ -925,25 +928,28 @@ Object {
925928
`;
926929

927930
exports[`Schema Testing Inheritance CubeB.js correctly extends cubeA.yml (with additions): joins 1`] = `
928-
Object {
929-
"order_users": Object {
931+
Array [
932+
Object {
933+
"name": "order_users",
930934
"relationship": "belongsTo",
931935
"sql": [Function],
932936
},
933-
}
937+
]
934938
`;
935939

936940
exports[`Schema Testing Inheritance CubeB.js correctly extends cubeA.yml (with additions): joins 2`] = `
937-
Object {
938-
"line_items": Object {
939-
"relationship": "hasMany",
941+
Array [
942+
Object {
943+
"name": "order_users",
944+
"relationship": "belongsTo",
940945
"sql": [Function],
941946
},
942-
"order_users": Object {
943-
"relationship": "belongsTo",
947+
Object {
948+
"name": "line_items",
949+
"relationship": "hasMany",
944950
"sql": [Function],
945951
},
946-
}
952+
]
947953
`;
948954

949955
exports[`Schema Testing Inheritance CubeB.js correctly extends cubeA.yml (with additions): measures 1`] = `
@@ -1223,25 +1229,28 @@ Object {
12231229
`;
12241230

12251231
exports[`Schema Testing Inheritance CubeB.yml correctly extends cubeA.js (with additions): joins 1`] = `
1226-
Object {
1227-
"order_users": Object {
1232+
Array [
1233+
Object {
1234+
"name": "order_users",
12281235
"relationship": "belongsTo",
12291236
"sql": [Function],
12301237
},
1231-
}
1238+
]
12321239
`;
12331240

12341241
exports[`Schema Testing Inheritance CubeB.yml correctly extends cubeA.js (with additions): joins 2`] = `
1235-
Object {
1236-
"line_items": Object {
1237-
"relationship": "hasMany",
1242+
Array [
1243+
Object {
1244+
"name": "order_users",
1245+
"relationship": "belongsTo",
12381246
"sql": [Function],
12391247
},
1240-
"order_users": Object {
1241-
"relationship": "belongsTo",
1248+
Object {
1249+
"name": "line_items",
1250+
"relationship": "hasMany",
12421251
"sql": [Function],
12431252
},
1244-
}
1253+
]
12451254
`;
12461255

12471256
exports[`Schema Testing Inheritance CubeB.yml correctly extends cubeA.js (with additions): measures 1`] = `
@@ -1563,25 +1572,28 @@ Object {
15631572
`;
15641573

15651574
exports[`Schema Testing Inheritance CubeB.yml correctly extends cubeA.yml (with additions): joins 1`] = `
1566-
Object {
1567-
"order_users": Object {
1575+
Array [
1576+
Object {
1577+
"name": "order_users",
15681578
"relationship": "belongsTo",
15691579
"sql": [Function],
15701580
},
1571-
}
1581+
]
15721582
`;
15731583

15741584
exports[`Schema Testing Inheritance CubeB.yml correctly extends cubeA.yml (with additions): joins 2`] = `
1575-
Object {
1576-
"line_items": Object {
1577-
"relationship": "hasMany",
1585+
Array [
1586+
Object {
1587+
"name": "order_users",
1588+
"relationship": "belongsTo",
15781589
"sql": [Function],
15791590
},
1580-
"order_users": Object {
1581-
"relationship": "belongsTo",
1591+
Object {
1592+
"name": "line_items",
1593+
"relationship": "hasMany",
15821594
"sql": [Function],
15831595
},
1584-
}
1596+
]
15851597
`;
15861598

15871599
exports[`Schema Testing Inheritance CubeB.yml correctly extends cubeA.yml (with additions): measures 1`] = `
@@ -1813,7 +1825,7 @@ Object {
18131825
},
18141826
],
18151827
"isView": true,
1816-
"joins": Object {},
1828+
"joins": Array [],
18171829
"measures": Object {
18181830
"count": Object {
18191831
"aggType": "count",
@@ -2078,3 +2090,23 @@ Array [
20782090
},
20792091
]
20802092
`;
2093+
2094+
exports[`Schema Testing join types 1`] = `
2095+
Array [
2096+
Object {
2097+
"name": "CubeB",
2098+
"relationship": "hasOne",
2099+
"sql": [Function],
2100+
},
2101+
Object {
2102+
"name": "CubeC",
2103+
"relationship": "hasMany",
2104+
"sql": [Function],
2105+
},
2106+
Object {
2107+
"name": "CubeD",
2108+
"relationship": "belongsTo",
2109+
"sql": [Function],
2110+
},
2111+
]
2112+
`;

packages/cubejs-schema-compiler/test/unit/schema.test.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -447,11 +447,7 @@ describe('Schema Testing', () => {
447447
]);
448448
await compiler.compile();
449449

450-
expect(cubeEvaluator.cubeFromPath('CubeA').joins).toMatchObject({
451-
CubeB: { relationship: 'hasOne' },
452-
CubeC: { relationship: 'hasMany' },
453-
CubeD: { relationship: 'belongsTo' }
454-
});
450+
expect(cubeEvaluator.cubeFromPath('CubeA').joins).toMatchSnapshot();
455451
});
456452

457453
describe('Access Policies', () => {

0 commit comments

Comments
 (0)