bito-code-review[bot] commented on code in PR #39684:
URL: https://github.com/apache/superset/pull/39684#discussion_r3467641804
##########
superset-frontend/plugins/plugin-chart-table/test/TableChart.test.tsx:
##########
@@ -473,6 +473,38 @@ describe('plugin-chart-table', () => {
expect(cells[4]).toHaveTextContent('2.47k');
});
+ test('render columns dropdown when visibleColumnsStorageKey is
provided', async () => {
+ const props = transformProps(testData.advanced);
+ const persistTableOwnState = jest.fn();
+ render(
+ ProviderWrapper({
+ children: (
+ <TableChart
+ {...props}
+ visibleColumnsStorageKey="table_col_key"
+ persistTableOwnState={persistTableOwnState}
+ sticky={false}
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Missing TypeScript type definitions</b></div>
<div id="fix">
The test passes `visibleColumnsStorageKey` and `persistTableOwnState` props
that are NOT defined in `TableChartTransformedProps` (see `types.ts` lines
84-131). This bypasses TypeScript validation and could cause runtime errors.
Additionally, the test fails to set `window.location.href` to a dashboard path,
causing the internal `visibleColumnsStorageKey` check at line 875 to return
`null` — the dropdown won't render because the condition at line 1021 evaluates
to `false`.
</div>
<details>
<summary>
<b>Code suggestion</b>
</summary>
<blockquote>Check the AI-generated fix before applying</blockquote>
<div id="code">
```
--- superset-frontend/plugins/plugin-chart-table/test/TableChart.test.tsx
(lines 476-506)---
476: test('render columns dropdown when visibleColumnsStorageKey is
provided', async () => {
477: const props = transformProps(testData.advanced);
478: // Set window location to satisfy dashboard path check in
TableChart.tsx:875
479: Object.defineProperty(window, 'location', {
480: value: { pathname: '/superset/dashboard/123/' },
481: writable: true,
482: });
483: const persistTableOwnState = jest.fn();
484: render(
485: ProviderWrapper({
486: children: (
487: <TableChart
488: {...props}
489: visibleColumnsStorageKey="table_col_key"
490: persistTableOwnState={persistTableOwnState}
491: sticky={false}
492: />
493: ),
494: }),
495: );
496:
497: // Find Columns dropdown
498: const columnsBtn = screen.getByText('Columns');
499: expect(columnsBtn).toBeInTheDocument();
```
</div>
</details>
</div>
<small><i>Code Review Run #762574</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]