hughhhh commented on code in PR #23731:
URL: https://github.com/apache/superset/pull/23731#discussion_r1171580244
##########
superset-frontend/packages/superset-ui-core/test/query/buildQueryContext.test.ts:
##########
@@ -164,4 +165,152 @@ describe('buildQueryContext', () => {
expect(spyNormalizeTimeColumn).not.toBeCalled();
spyNormalizeTimeColumn.mockRestore();
});
+ it('should fix pivot v2 charts saved before GENERIC_CHART_AXES was enabled',
() => {
+ Object.defineProperty(buildQueryContextModule, 'hasGenericChartAxes', {
+ value: true,
+ });
+ const queryContext = buildQueryContext(
+ {
+ datasource: '22__table',
+ viz_type: 'pivot_table_v2',
+ slice_id: 138,
+ url_params: {
+ native_filters_key:
+ 'oGUUQKLlluSODgWflOlhSKi2dMljuOTbyGVxVlZ8s5xp_nTJpd3rdWram_xNDotb',
+ },
+ groupbyColumns: ['order_date'],
+ groupbyRows: [],
+ time_grain_sqla: 'P1M',
+ temporal_columns_lookup: {},
+ metrics: ['count'],
+ metricsLayout: 'COLUMNS',
+ adhoc_filters: [],
+ row_limit: 10000,
+ order_desc: true,
+ aggregateFunction: 'Sum',
+ valueFormat: 'SMART_NUMBER',
+ date_format: 'smart_date',
+ rowOrder: 'key_a_to_z',
+ colOrder: 'key_a_to_z',
+ dashboards: [13],
+ extra_form_data: {},
+ granularity_sqla: 'order_date',
+ time_range: 'No filter',
+ label_colors: {},
+ shared_label_colors: {},
+ extra_filters: [],
+ dashboardId: 13,
+ force: undefined,
+ result_format: 'json',
+ result_type: 'full',
+ },
+ () => [
+ {
+ annotation_layers: [],
+ applied_time_extras: {},
+ columns: ['order_date'],
+ custom_form_data: {},
+ custom_params: {},
+ extras: {
+ having: '',
+ where: '',
+ },
+ filters: [],
+ granularity: 'order_date',
+ metrics: ['count'],
+ order_desc: true,
+ orderby: [['count', false]],
+ row_limit: 10000,
+ series_limit: 0,
+ time_range: 'No filter',
+ url_params: {
+ native_filters_key:
+
'oGUUQKLlluSODgWflOlhSKi2dMljuOTbyGVxVlZ8s5xp_nTJpd3rdWram_xNDotb',
+ },
+ },
+ ],
+ );
+ expect(queryContext).toEqual({
+ datasource: {
Review Comment:
nit: rather put this into `expectedResult` const then at the bottom have
this:
```
expect(queryContext).toEqual(expectedResult)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]