codeant-ai-for-open-source[bot] commented on code in PR #37131:
URL: https://github.com/apache/superset/pull/37131#discussion_r3465711580


##########
superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/useExploreAdditionalActionsMenu.test.jsx:
##########
@@ -0,0 +1,145 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import React from 'react';
+import { render, screen, waitFor } from 'spec/helpers/testing-library';
+import userEvent from '@testing-library/user-event';
+import { useExploreAdditionalActionsMenu } from './index';
+import * as exploreUtils from 'src/explore/exploreUtils';
+
+jest.mock('src/explore/exploreUtils', () => ({
+  __esModule: true,
+  ...jest.requireActual('src/explore/exploreUtils'),
+  exportChart: jest.fn(),
+  getChartKey: jest.fn(() => 'test_chart_key'),
+}));
+
+const mockAddDangerToast = jest.fn();
+jest.mock('src/components/MessageToasts/withToasts', () => ({
+  __esModule: true,
+  default: component => component,
+  useToasts: () => ({
+    addDangerToast: mockAddDangerToast,
+    addSuccessToast: jest.fn(),
+  }),
+}));
+
+jest.mock('src/logger/actions', () => ({
+  logEvent: jest.fn(() => ({ type: 'LOG_EVENT' })),
+}));
+
+jest.mock('@superset-ui/core', () => ({
+  ...jest.requireActual('@superset-ui/core'),
+  getChartMetadataRegistry: jest.fn(() => ({
+    get: jest.fn(() => ({ behaviors: ['EXPORT_CURRENT_VIEW'] })),
+  })),
+}));
+
+const defaultProps = {
+  latestQueryFormData: {
+    datasource: '1__table',
+    viz_type: 'pivot_table_v2',
+  },
+  canDownloadCSV: true,
+  slice: { slice_id: 1, slice_name: 'Test Chart' },
+  ownState: {},
+  dashboards: [],
+  onOpenInEditor: jest.fn(),
+  onOpenPropertiesModal: jest.fn(),
+  showReportModal: jest.fn(),
+  setCurrentReportDeleting: jest.fn(),
+};
+
+const TestComponent = props => {

Review Comment:
   **Suggestion:** Convert this newly added frontend test from `.test.jsx` to 
`.test.tsx` and add an explicit props type for the test component so the new 
code follows the TypeScript-only frontend rule. [custom_rule]
   
   **Severity Level:** Minor ⚠️
   <details>
   <summary><b>Why it matters? 🤔 </b></summary>
   
   This is a newly added frontend test file with a `.jsx` extension, which 
violates the rule requiring frontend code to be TypeScript rather than 
JavaScript. The untyped `props` parameter also reflects the same lack of 
TypeScript typing the suggestion calls out.
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=4451fdec18ca4f48a7c2c152f8565378&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=4451fdec18ca4f48a7c2c152f8565378&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** 
superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/useExploreAdditionalActionsMenu.test.jsx
   **Line:** 68:68
   **Comment:**
        *Custom Rule: Convert this newly added frontend test from `.test.jsx` 
to `.test.tsx` and add an explicit props type for the test component so the new 
code follows the TypeScript-only frontend rule.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F37131&comment_hash=687ea3a0278f9ef107c3b560c6b2a84fddc7b56de77528c66f185290953d8653&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F37131&comment_hash=687ea3a0278f9ef107c3b560c6b2a84fddc7b56de77528c66f185290953d8653&reaction=dislike'>👎</a>



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