This is an automated email from the ASF dual-hosted git repository.

rusackas pushed a commit to branch viz-pipeline-followups
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 1ebad418a09381fbcfb7743d69eeb2714e51426d
Author: Claude Code <[email protected]>
AuthorDate: Tue Jul 28 01:25:57 2026 -0700

    test(partition): cover transformProps' v1-record path and level mapping
    
    transformData.ts had thorough tests, but transformProps.ts itself --
    the glue that decides between the v1 flat-record path and the legacy
    nested-hierarchy passthrough, maps groupby columns through verboseMap,
    and parses partitionLimit/Threshold -- had none.
    
    Co-Authored-By: Claude Sonnet 5 <[email protected]>
---
 .../test/transformProps.test.ts                    | 78 ++++++++++++++++++++++
 1 file changed, 78 insertions(+)

diff --git 
a/superset-frontend/plugins/plugin-chart-partition/test/transformProps.test.ts 
b/superset-frontend/plugins/plugin-chart-partition/test/transformProps.test.ts
new file mode 100644
index 00000000000..3ce9ff6bcd2
--- /dev/null
+++ 
b/superset-frontend/plugins/plugin-chart-partition/test/transformProps.test.ts
@@ -0,0 +1,78 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { supersetTheme } from '@apache-superset/core/theme';
+import { ChartProps } from '@superset-ui/core';
+import transformProps from '../src/transformProps';
+
+const baseFormData = {
+  colorScheme: 'supersetColors',
+  groupby: ['gender', 'state'],
+  metrics: ['sum__num'],
+  timeSeriesOption: 'not_time',
+  numberFormat: 'SMART_NUMBER',
+  sliceId: 1,
+};
+
+function buildChartProps(overrides: Record<string, unknown> = {}) {
+  return new ChartProps({
+    width: 400,
+    height: 300,
+    theme: supersetTheme,
+    formData: { ...baseFormData, ...overrides },
+    datasource: { verboseMap: { gender: 'Gender', state: 'State' } },
+    queriesData: [
+      {
+        data: [
+          { gender: 'boy', state: 'CA', sum__num: 10 },
+          { gender: 'girl', state: 'NY', sum__num: 20 },
+        ],
+      },
+    ],
+  }) as ChartProps;
+}
+
+test('builds the hierarchy from v1 flat records and maps levels through 
verboseMap', () => {
+  const result = transformProps(buildChartProps());
+  expect(result.width).toEqual(400);
+  expect(result.height).toEqual(300);
+  expect(result.levels).toEqual(['Gender', 'State']);
+  expect(result.data).toHaveLength(1);
+  expect(result.data[0].val).toEqual(30);
+});
+
+test('falls back to the raw column name when verboseMap has no entry', () => {
+  const result = transformProps(
+    buildChartProps({ groupby: ['gender', 'unmapped_col'] }),
+  );
+  expect(result.levels).toEqual(['Gender', 'unmapped_col']);
+});
+
+test('parses partitionLimit and partitionThreshold as integers', () => {
+  const result = transformProps(
+    buildChartProps({ partitionLimit: '5', partitionThreshold: '0.1' }),
+  );
+  expect(result.partitionLimit).toEqual(5);
+  expect(result.partitionThreshold).toEqual(0);
+});
+
+test('leaves partitionLimit and partitionThreshold undefined when unset', () 
=> {
+  const result = transformProps(buildChartProps());
+  expect(result.partitionLimit).toBeFalsy();
+  expect(result.partitionThreshold).toBeFalsy();
+});

Reply via email to