File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed
packages/cubejs-api-gateway/test Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -316,7 +316,7 @@ describe('API Gateway', () => {
316316 expect ( res . body && res . body . data ) . toStrictEqual ( [ { 'Foo.bar' : 42 } ] ) ;
317317 } ) ;
318318
319- test ( 'custom granularities in annotation' , async ( ) => {
319+ test ( 'custom granularities in annotation from timeDimensions ' , async ( ) => {
320320 const { app } = await createApiGateway ( ) ;
321321
322322 const res = await request ( app )
@@ -338,6 +338,29 @@ describe('API Gateway', () => {
338338 } ) ;
339339 } ) ;
340340
341+
342+ test ( 'custom granularities in annotation from dimensions' , async ( ) => {
343+ const { app } = await createApiGateway ( ) ;
344+
345+ const res = await request ( app )
346+ . get (
347+ '/cubejs-api/v1/load?query={"measures":["Foo.bar"],"dimensions":["Foo.timeGranularities.half_year_by_1st_april"]}'
348+ )
349+ . set ( 'Authorization' , 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.e30.t-IDcSemACt8x4iTMCda8Yhe3iZaWbvV5XKSTbuAn0M' )
350+ . expect ( 200 ) ;
351+ console . log ( res . body ) ;
352+ expect ( res . body && res . body . data ) . toStrictEqual ( [ { 'Foo.bar' : 42 } ] ) ;
353+ expect ( res . body . annotation . timeDimensions [ 'Foo.timeGranularities.half_year_by_1st_april' ] )
354+ . toStrictEqual ( {
355+ granularity : {
356+ name : 'half_year_by_1st_april' ,
357+ title : 'Half Year By1 St April' ,
358+ interval : '6 months' ,
359+ offset : '3 months' ,
360+ }
361+ } ) ;
362+ } ) ;
363+
341364 test ( 'dry-run' , async ( ) => {
342365 const { app } = await createApiGateway ( ) ;
343366
You can’t perform that action at this time.
0 commit comments