Skip to content

Commit 5e6008a

Browse files
committed
add tests
1 parent 5e22852 commit 5e6008a

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
cubes:
2+
- name: base_cube
3+
sql_table: foo
4+
5+
dimensions:
6+
- name: status
7+
sql: status
8+
type: string
9+
10+
- name: barbus
11+
sql: barbus
12+
type: string
13+
14+
measures:
15+
- name: count
16+
type: count
17+
18+
- name: child_cube
19+
extends: base_cube
20+
21+
dimensions:
22+
- name: bar
23+
sql: bar
24+
25+
- name: baz
26+
sql: baz
27+
type: string

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,5 +1009,26 @@ describe('Schema Testing', () => {
10091009
expect(cubeB.sqlTable).toBeTruthy();
10101010
expect(cubeB.sql).toBeFalsy();
10111011
});
1012+
1013+
it('throws error for member without type in cubeB extending cubeA', async () => {
1014+
const cubes = fs.readFileSync(
1015+
path.join(process.cwd(), '/test/unit/fixtures/no_type_ext_cube.yaml'),
1016+
'utf8'
1017+
);
1018+
const { compiler } = prepareCompiler([
1019+
{
1020+
content: cubes,
1021+
fileName: 'no_type_ext_cube.yaml',
1022+
},
1023+
]);
1024+
1025+
try {
1026+
await compiler.compile();
1027+
throw new Error('should throw earlier');
1028+
} catch (e: any) {
1029+
expect(e.toString()).toMatch(/child_cube cube: "dimensions\.bar" does not match any of the allowed types/);
1030+
expect(e.toString()).toMatch(/\(dimensions\.bar\.type\) is required/);
1031+
}
1032+
});
10121033
});
10131034
});

0 commit comments

Comments
 (0)