File tree Expand file tree Collapse file tree 2 files changed +48
-0
lines changed
packages/cubejs-schema-compiler/test/unit Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff 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 ( / c h i l d _ c u b e c u b e : " d i m e n s i o n s \. b a r " d o e s n o t m a t c h a n y o f t h e a l l o w e d t y p e s / ) ;
1030+ expect ( e . toString ( ) ) . toMatch ( / \( d i m e n s i o n s \. b a r \. t y p e \) i s r e q u i r e d / ) ;
1031+ }
1032+ } ) ;
10121033 } ) ;
10131034} ) ;
You can’t perform that action at this time.
0 commit comments