From d2fdb05f7e87a92dc7ffaeb5fe1e85049607a30b Mon Sep 17 00:00:00 2001 From: Antonio Rivero Date: Thu, 2 Nov 2023 11:43:12 -0300 Subject: [PATCH] fix(charts): Time grain is None when dataset uses Jinja - Fix tests --- .../test/query/normalizeTimeColumn.test.ts | 8 +++++--- .../test/MixedTimeseries/buildQuery.test.ts | 1 + .../test/Timeseries/buildQuery.test.ts | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/superset-frontend/packages/superset-ui-core/test/query/normalizeTimeColumn.test.ts b/superset-frontend/packages/superset-ui-core/test/query/normalizeTimeColumn.test.ts index 22189b90551c..2f6bdd0fb507 100644 --- a/superset-frontend/packages/superset-ui-core/test/query/normalizeTimeColumn.test.ts +++ b/superset-frontend/packages/superset-ui-core/test/query/normalizeTimeColumn.test.ts @@ -92,7 +92,9 @@ describe('GENERIC_CHART_AXES is disabled', () => { datasource: '5__table', viz_type: 'table', granularity: 'time_column', - extras: {}, + extras: { + time_grain_sqla: 'P1Y', + }, time_range: '1 year ago : 2013', orderby: [['count(*)', true]], columns: [ @@ -182,7 +184,7 @@ describe('GENERIC_CHART_AXES is enabled', () => { datasource: '5__table', viz_type: 'table', granularity: 'time_column', - extras: { where: '', having: '' }, + extras: { where: '', having: '', time_grain_sqla: 'P1Y' }, time_range: '1 year ago : 2013', orderby: [['count(*)', true]], columns: [ @@ -240,7 +242,7 @@ describe('GENERIC_CHART_AXES is enabled', () => { datasource: '5__table', viz_type: 'table', granularity: 'time_column', - extras: { where: '', having: '' }, + extras: { where: '', having: '', time_grain_sqla: 'P1Y' }, time_range: '1 year ago : 2013', orderby: [['count(*)', true]], columns: [ diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/MixedTimeseries/buildQuery.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/MixedTimeseries/buildQuery.test.ts index 15d9e2cbb6e1..7aef4f582a32 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/test/MixedTimeseries/buildQuery.test.ts +++ b/superset-frontend/plugins/plugin-chart-echarts/test/MixedTimeseries/buildQuery.test.ts @@ -307,6 +307,7 @@ test('should convert a queryObject with x-axis although FF is disabled', () => { extras: { having: '', where: "(foo in ('a', 'b'))", + time_grain_sqla: 'P1W', }, applied_time_extras: {}, columns: [ diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/buildQuery.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/buildQuery.test.ts index 611f021af16f..8887342933ca 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/buildQuery.test.ts +++ b/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/buildQuery.test.ts @@ -120,7 +120,7 @@ describe('GENERIC_CHART_AXES is enabled', () => { expect.objectContaining({ granularity: 'time_column', time_range: '1 year ago : 2013', - extras: { having: '', where: '' }, + extras: { having: '', where: '', time_grain_sqla: 'P1Y' }, columns: [ { columnType: 'BASE_AXIS', @@ -209,7 +209,7 @@ describe('GENERIC_CHART_AXES is disabled', () => { expect.objectContaining({ granularity: 'time_column', time_range: '1 year ago : 2013', - extras: { having: '', where: '' }, + extras: { having: '', where: '', time_grain_sqla: 'P1Y' }, columns: [ { columnType: 'BASE_AXIS',