mirror of
https://github.com/apache/superset.git
synced 2026-04-18 23:55:00 +00:00
refactor: Removes the deprecated GENERIC_CHART_AXES feature flag (#26372)
This commit is contained in:
committed by
GitHub
parent
d8f7e2ce5e
commit
8a2f7d378a
@@ -61,111 +61,7 @@ describe('Timeseries buildQuery', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('GENERIC_CHART_AXES is enabled', () => {
|
||||
let windowSpy: any;
|
||||
|
||||
beforeAll(() => {
|
||||
// @ts-ignore
|
||||
windowSpy = jest.spyOn(window, 'window', 'get').mockImplementation(() => ({
|
||||
featureFlags: {
|
||||
GENERIC_CHART_AXES: true,
|
||||
},
|
||||
}));
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
windowSpy.mockRestore();
|
||||
});
|
||||
|
||||
const formData: SqlaFormData = {
|
||||
datasource: '5__table',
|
||||
viz_type: 'table',
|
||||
granularity_sqla: 'time_column',
|
||||
time_grain_sqla: 'P1Y',
|
||||
time_range: '1 year ago : 2013',
|
||||
groupby: ['col1'],
|
||||
metrics: ['count(*)'],
|
||||
};
|
||||
|
||||
it("shouldn't convert queryObject", () => {
|
||||
const { queries } = buildQuery(formData);
|
||||
expect(queries[0]).toEqual(
|
||||
expect.objectContaining({
|
||||
granularity: 'time_column',
|
||||
time_range: '1 year ago : 2013',
|
||||
extras: { time_grain_sqla: 'P1Y', having: '', where: '' },
|
||||
columns: ['col1'],
|
||||
series_columns: ['col1'],
|
||||
metrics: ['count(*)'],
|
||||
is_timeseries: true,
|
||||
post_processing: [
|
||||
{
|
||||
operation: 'pivot',
|
||||
options: {
|
||||
aggregates: { 'count(*)': { operator: 'mean' } },
|
||||
columns: ['col1'],
|
||||
drop_missing_columns: true,
|
||||
index: ['__timestamp'],
|
||||
},
|
||||
},
|
||||
{ operation: 'flatten' },
|
||||
],
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it('should convert queryObject', () => {
|
||||
const { queries } = buildQuery({ ...formData, x_axis: 'time_column' });
|
||||
expect(queries[0]).toEqual(
|
||||
expect.objectContaining({
|
||||
granularity: 'time_column',
|
||||
time_range: '1 year ago : 2013',
|
||||
extras: { having: '', where: '', time_grain_sqla: 'P1Y' },
|
||||
columns: [
|
||||
{
|
||||
columnType: 'BASE_AXIS',
|
||||
expressionType: 'SQL',
|
||||
label: 'time_column',
|
||||
sqlExpression: 'time_column',
|
||||
timeGrain: 'P1Y',
|
||||
},
|
||||
'col1',
|
||||
],
|
||||
series_columns: ['col1'],
|
||||
metrics: ['count(*)'],
|
||||
post_processing: [
|
||||
{
|
||||
operation: 'pivot',
|
||||
options: {
|
||||
aggregates: { 'count(*)': { operator: 'mean' } },
|
||||
columns: ['col1'],
|
||||
drop_missing_columns: true,
|
||||
index: ['time_column'],
|
||||
},
|
||||
},
|
||||
{ operation: 'flatten' },
|
||||
],
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('GENERIC_CHART_AXES is disabled', () => {
|
||||
let windowSpy: any;
|
||||
|
||||
beforeAll(() => {
|
||||
// @ts-ignore
|
||||
windowSpy = jest.spyOn(window, 'window', 'get').mockImplementation(() => ({
|
||||
featureFlags: {
|
||||
GENERIC_CHART_AXES: false,
|
||||
},
|
||||
}));
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
windowSpy.mockRestore();
|
||||
});
|
||||
|
||||
describe('queryObject conversion', () => {
|
||||
const formData: SqlaFormData = {
|
||||
datasource: '5__table',
|
||||
viz_type: 'table',
|
||||
|
||||
Reference in New Issue
Block a user