geido commented on code in PR #36831:
URL: https://github.com/apache/superset/pull/36831#discussion_r2651187733


##########
superset-frontend/src/pages/ChartCreation/ChartCreation.test.tsx:
##########
@@ -193,3 +193,95 @@ test('double-click viz type submits with formatted URL if 
datasource is selected
   const formattedUrl = '/explore/?viz_type=table&datasource=table_1__table';
   expect(history.push).toHaveBeenCalledWith(formattedUrl);
 });
+
+test('uses contains (ct) operator for dropdown search', async () => {
+  fetchMock.reset();
+  const mockFetch = fetchMock.get(/\/api\/v1\/dataset\/\?q=.*/, {
+    body: mockDatasourceResponse,
+    status: 200,
+  });
+
+  await renderComponent();
+
+  const datasourceSelect = await screen.findByRole('combobox', {
+    name: 'Dataset',
+  });
+  userEvent.click(datasourceSelect);
+  userEvent.type(datasourceSelect, 'test');
+
+  await waitFor(() => {
+    const calls = mockFetch.calls();
+    const lastCall = calls[calls.length - 1];
+    expect(lastCall[0]).toContain('opr:ct');
+  });

Review Comment:
   Can we test also the behavior for the user and not just that of the code? 
For instance, we could check that the dropdown options return the right result. 



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