SkinnyPigeon commented on code in PR #42475:
URL: https://github.com/apache/superset/pull/42475#discussion_r3672569750


##########
superset-frontend/src/pages/ChartCreation/ChartCreation.test.tsx:
##########
@@ -333,6 +333,63 @@ test('shows loading spinner when dataset parameter is 
present in URL', async ()
   locationSpy.mockRestore();
 });
 
+test('dataset dropdown sorts options alphabetically by table name regardless 
of id order', async () => {
+  fetchMock.clearHistory().removeRoutes();
+  // IDs are deliberately NOT in alphabetical order of table_name to prove
+  // that sorting is by name, not by creation/id order.
+  fetchMock.get(/\/api\/v1\/dataset\/\?q=.*/, {
+    body: {
+      result: [
+        {
+          id: 3,
+          table_name: 'alpha_table',
+          datasource_type: 'table',
+          database: { database_name: 'test_db' },
+          schema: 'public',
+        },
+        {
+          id: 1,
+          table_name: 'beta_table',
+          datasource_type: 'table',
+          database: { database_name: 'test_db' },
+          schema: 'public',
+        },
+        {
+          id: 2,
+          table_name: 'gamma_table',
+          datasource_type: 'table',
+          database: { database_name: 'test_db' },
+          schema: 'public',
+        },
+      ],

Review Comment:
   Makes sense



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