File tree Expand file tree Collapse file tree 2 files changed +72
-0
lines changed
packages/cubejs-schema-compiler/test/unit Expand file tree Collapse file tree 2 files changed +72
-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 : parent_dim_no_type
11+ sql : barbus
12+
13+ - name : parent_dim_bad_type
14+ type : bad_type
15+ sql : badus
16+
17+ - name : parent_dim_no_sql
18+ type : string
19+
20+ measures :
21+ - name : count
22+ type : count
23+
24+ - name : parent_meas_no_type
25+
26+ - name : parent_meas_bad_type
27+ type : bad_type
28+
29+ - name : child_cube
30+ extends : base_cube
31+
32+ dimensions :
33+ - name : bar
34+ sql : bar
35+ type : string
36+
37+ - name : child_dim_no_type
38+ sql : barbus
39+
40+ - name : child_dim_bad_type
41+ type : bad_type
42+ sql : shmarbus
43+
44+ - name : child_dim_no_sql
45+ type : number
Original file line number Diff line number Diff line change @@ -1013,5 +1013,32 @@ describe('Schema Testing', () => {
10131013 expect ( cubeB . sqlTable ) . toBeTruthy ( ) ;
10141014 expect ( cubeB . sql ) . toBeFalsy ( ) ;
10151015 } ) ;
1016+
1017+ it ( 'throws error for member without type in cubeB extending cubeA' , async ( ) => {
1018+ const cubes = fs . readFileSync (
1019+ path . join ( process . cwd ( ) , '/test/unit/fixtures/invalid_cubes.yaml' ) ,
1020+ 'utf8'
1021+ ) ;
1022+ const { compiler } = prepareCompiler ( [
1023+ {
1024+ content : cubes ,
1025+ fileName : 'invalid_cubes.yaml' ,
1026+ } ,
1027+ ] ) ;
1028+
1029+ try {
1030+ await compiler . compile ( ) ;
1031+ throw new Error ( 'should throw earlier' ) ;
1032+ } catch ( e : any ) {
1033+ expect ( e . toString ( ) ) . toMatch ( / " m e a s u r e s \. p a r e n t _ m e a s _ n o _ t y p e \. s q l " i s r e q u i r e d / ) ;
1034+ expect ( e . toString ( ) ) . toMatch ( / " m e a s u r e s \. p a r e n t _ m e a s _ n o _ t y p e \. t y p e " i s r e q u i r e d / ) ;
1035+ expect ( e . toString ( ) ) . toMatch ( / " m e a s u r e s \. p a r e n t _ m e a s _ b a d _ t y p e \. t y p e " m u s t b e o n e o f / ) ;
1036+ expect ( e . toString ( ) ) . toMatch ( / " d i m e n s i o n s \. p a r e n t _ d i m _ n o _ t y p e " 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 / ) ;
1037+ expect ( e . toString ( ) ) . toMatch ( / " d i m e n s i o n s \. p a r e n t _ d i m _ n o _ s q l " 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 / ) ;
1038+ expect ( e . toString ( ) ) . toMatch ( / " d i m e n s i o n s \. c h i l d _ d i m _ n o _ t y p e " 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 / ) ;
1039+ expect ( e . toString ( ) ) . toMatch ( / " d i m e n s i o n s \. c h i l d _ d i m _ b a d _ t y p e " 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 / ) ;
1040+ expect ( e . toString ( ) ) . toMatch ( / " d i m e n s i o n s \. c h i l d _ d i m _ n o _ s q l " 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 / ) ;
1041+ }
1042+ } ) ;
10161043 } ) ;
10171044} ) ;
You can’t perform that action at this time.
0 commit comments