File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed
superset-frontend/plugins/plugin-chart-echarts/test/BigNumber Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -133,7 +133,29 @@ describe('BigNumberWithTrendline', () => {
133133 // bigNumberFallback is only set when bigNumber is null after aggregation
134134 expect ( transformed . bigNumberFallback ) . toBeNull ( ) ;
135135
136- // should successfully formatTime by granularity
136+ // should successfully formatTime by granularity(QUARTER)
137+ // @ts -ignore
138+ expect ( transformed . formatTime ( new Date ( '2020-01-01' ) ) ) . toStrictEqual (
139+ '2020 Q1' ,
140+ ) ;
141+ } ) ;
142+
143+ it ( 'should format time with by "SECOND" granularity only if time_grain_sqla were TimeGranularity.SECOND' , ( ) => {
144+ const propsWithSecondGranularity = {
145+ ...props ,
146+ // ensure extractTimegrain() gets SECOND granularity
147+ rawFormData : {
148+ ...rawFormData ,
149+ time_grain_sqla : TimeGranularity . SECOND ,
150+ } ,
151+ formData : {
152+ ...props . formData ,
153+ timeGrainSqla : TimeGranularity . SECOND ,
154+ } ,
155+ } as unknown as BigNumberWithTrendlineChartProps ;
156+
157+ const transformed = transformProps ( propsWithSecondGranularity ) ;
158+ // should successfully formatTime by granularity(SECOND)
137159 // @ts -ignore
138160 expect ( transformed . formatTime ( new Date ( '2020-01-01' ) ) ) . toStrictEqual (
139161 '2020-01-01 00:00:00' ,
You can’t perform that action at this time.
0 commit comments