msyavuz commented on code in PR #35277:
URL: https://github.com/apache/superset/pull/35277#discussion_r2382808983


##########
superset-frontend/packages/superset-ui-core/src/components/TableCollection/TableCollection.test.tsx:
##########
@@ -206,3 +206,38 @@ test('Bulk selection should work with pagination', () => {
   const checkboxes = screen.getAllByRole('checkbox');
   expect(checkboxes.length).toBeGreaterThan(0);
 });
+
+test('handleTableChange should convert array field to dot notation for nested 
fields', () => {
+  const setSortBy = jest.fn();
+  const sortingProps = {
+    ...defaultProps,
+    setSortBy,
+  };
+
+  render(<TableCollection {...sortingProps} />);
+
+  // Test the array-to-dot-notation conversion logic directly
+  const mockArraySorter = {
+    field: ['database', 'database_name'],
+    order: 'descend' as const,
+  };
+
+  const mockStringSorter = {
+    field: 'table_name',
+    order: 'ascend' as const,
+  };
+
+  // Test array field conversion
+  const fieldIdArray = Array.isArray(mockArraySorter.field)
+    ? mockArraySorter.field.join('.')
+    : mockArraySorter.field;
+
+  expect(fieldIdArray).toBe('database.database_name');
+
+  // Test string field passthrough
+  const fieldIdString = Array.isArray(mockStringSorter.field)
+    ? mockStringSorter.field.join('.')
+    : mockStringSorter.field;
+
+  expect(fieldIdString).toBe('table_name');

Review Comment:
   Yeah this just implements the logic in the component again. If the component 
logic changes for any reason this test will still pass as it does not interact 
with the component.



-- 
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]

Reply via email to