bito-code-review[bot] commented on PR #36831:
URL: https://github.com/apache/superset/pull/36831#issuecomment-3696793784
<!-- Bito Reply -->
Yes, we can add tests to verify user-facing behavior, such as ensuring the
dropdown displays the correct options based on the API response. For example,
mock the dataset API to return specific results and assert that those options
appear in the UI.
**superset-frontend/src/pages/ChartCreation/ChartCreation.test.tsx**
```
test('displays correct dropdown options from API response', async () => {
fetchMock.get(/\/api\/v1\/dataset\/\?q=.*/, {
body: {
result: [
{ id: 1, table_name: 'test_table', datasource_type: 'table' },
],
count: 1,
},
status: 200,
});
await renderComponent();
const datasourceSelect = screen.getByRole('combobox', { name: 'Dataset' });
userEvent.click(datasourceSelect);
await waitFor(() => {
expect(screen.getByText('test_table')).toBeInTheDocument();
});
});
```
--
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]