bito-code-review[bot] commented on code in PR #37141:
URL: https://github.com/apache/superset/pull/37141#discussion_r2824781152
##########
superset-frontend/src/features/home/Menu.test.tsx:
##########
@@ -24,6 +24,15 @@ import { getExtensionsRegistry } from '@superset-ui/core';
import { Menu } from './Menu';
import * as getBootstrapData from 'src/utils/getBootstrapData';
+// Mock useBreakpoint to return desktop breakpoints (prevents mobile menu
rendering)
+jest.mock('antd', () => ({
+ ...jest.requireActual('antd'),
+ Grid: {
+ ...jest.requireActual('antd').Grid,
+ useBreakpoint: () => ({ xs: true, sm: true, md: true, lg: true, xl: true
}),
+ },
+}));
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Incorrect Test Mock & Guideline Violation</b></div>
<div id="fix">
The mock change fixes the incorrect override of useBreakpoint but violates
guidelines by importing antd directly. The previous mock added useBreakpoint to
the wrong place (module exports instead of Grid), so it didn't work. Mock the
superset-ui module instead to follow 'Use @superset-ui/core - Don't import Ant
Design directly'.
</div>
<details>
<summary>
<b>Code suggestion</b>
</summary>
<blockquote>Check the AI-generated fix before applying</blockquote>
<div id="code">
````suggestion
jest.mock('@superset-ui/core/components/Grid', () => ({
...jest.requireActual('@superset-ui/core/components/Grid'),
Grid: {
...jest.requireActual('@superset-ui/core/components/Grid').Grid,
useBreakpoint: () => ({ xs: true, sm: true, md: true, lg: true, xl:
true }),
},
}));
````
</div>
</details>
</div>
<details>
<summary><b>Citations</b></summary>
<ul>
<li>
Rule Violated: <a
href="https://github.com/apache/superset/blob/6f614c4/.cursor/rules/dev-standard.mdc#L19">dev-standard.mdc:19</a>
</li>
<li>
Rule Violated: <a
href="https://github.com/apache/superset/blob/6f614c4/AGENTS.md#L33">AGENTS.md:33</a>
</li>
</ul>
</details>
<small><i>Code Review Run #c35d7f</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]