bito-code-review[bot] commented on code in PR #43051:
URL: https://github.com/apache/superset/pull/43051#discussion_r3789004054
##########
superset-frontend/src/dashboard/components/PropertiesModal/sections/BasicInfoSection.test.tsx:
##########
@@ -110,7 +110,7 @@ test('can type in name field', async () => {
);
const nameInput = screen.getByTestId('dashboard-title-input');
- await userEvent.type(nameInput, 'My Dashboard');
+ userEvent.type(nameInput, 'My Dashboard');
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Missing await on async userEvent</b></div>
<div id="fix">
The `userEvent.type()` call is not awaited. This is an async function that
returns a Promise — without `await`, the assertion on line 115 may execute
before typing completes, causing a flaky test. Other test files in this repo
(e.g., `DynamicEditableTitle.regression.test.tsx`, `TextControl.test.tsx`) use
`await userEvent.type()` correctly.
</div>
</div>
<small><i>Code Review Run #d2f2c4</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
##########
superset-frontend/src/pages/DashboardList/DashboardList.listview.test.tsx:
##########
@@ -310,7 +310,7 @@ test('supports bulk delete of selected dashboards', async
() => {
// Type DELETE in the confirmation input
const deleteInput = screen.getByTestId('delete-modal-input');
- await userEvent.type(deleteInput, 'DELETE');
+ userEvent.type(deleteInput, 'DELETE');
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Inconsistent async pattern</b></div>
<div id="fix">
Removing `await` creates inconsistency with the rest of this file where
other `userEvent` calls (lines 282, 291, 302) use `await`. Although v13
`userEvent.type()` is synchronous without `delay` option, keeping `await`
maintains pattern consistency and prevents subtle bugs if the library is
upgraded to v14 where `await` becomes required.
</div>
</div>
<small><i>Code Review Run #d2f2c4</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
##########
superset-frontend/packages/superset-ui-core/src/components/DeleteModal/DeleteModal.test.tsx:
##########
@@ -139,7 +139,7 @@ test('Calling "onConfirm" only after typing "delete" in the
input', async () =>
expect(props.onConfirm).toHaveBeenCalledTimes(0);
// execute "onConfirm" if you have typed "delete"
- await userEvent.type(screen.getByTestId('delete-modal-input'), 'delete');
+ userEvent.type(screen.getByTestId('delete-modal-input'), 'delete');
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Missing await on async call</b></div>
<div id="fix">
Remove `await` from `userEvent.type()` creates a timing-dependent test. In
v14.x, `userEvent.type()` returns a Promise that must be awaited to ensure the
typing completes before the subsequent `userEvent.click()` call. Without await,
the test proceeds immediately without waiting for the Promise to resolve, which
can cause flaky behavior. The same file consistently uses `await` for other
`userEvent` calls on lines 138 and 143.
</div>
</div>
<small><i>Code Review Run #d2f2c4</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
##########
superset-frontend/src/features/versionHistory/VersionHistoryPanel.test.tsx:
##########
@@ -350,10 +350,7 @@ test('typing in the search box forwards the term to the
container', async () =>
const props = defaultProps([group()]);
render(<VersionHistoryPanel {...props} />);
- await userEvent.type(
- screen.getByRole('textbox', { name: 'Search actions' }),
- 'z',
- );
+ userEvent.type(screen.getByRole('textbox', { name: 'Search actions' }), 'z');
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Missing await for Promise</b></div>
<div id="fix">
In `@testing-library/user-event` v14, all methods including `type()` return
Promises and must be awaited. This test will fail when v14 is installed because
the returned Promise is not being awaited. The test function is already `async`
(line 349), so adding `await` is the minimal fix.
</div>
</div>
<small><i>Code Review Run #d2f2c4</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
--
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]