codeant-ai-for-open-source[bot] commented on code in PR #39461:
URL: https://github.com/apache/superset/pull/39461#discussion_r3481480041
##########
superset-frontend/src/explore/components/controls/DatasourceControl/DatasourceControl.test.tsx:
##########
@@ -251,25 +265,26 @@ test('Should show SQL Lab for sql_lab role', async () => {
test('Click on Swap dataset option', async () => {
const props = createProps();
- jest
- .spyOn(SupersetClient, 'get')
- .mockImplementation(async ({ endpoint }: { endpoint: string }) => {
+ SupersetClientGet.mockImplementationOnce(
+ async ({ endpoint }: { endpoint: string }) => {
if (endpoint.includes('_info')) {
return {
json: { permissions: ['can_read', 'can_write'] },
} as any;
}
Review Comment:
**Suggestion:** Replace this `any` cast with a concrete mocked response type
that matches the expected `SupersetClient.get` return shape for the permissions
branch. [custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
The file is TypeScript/TSX, and this new test code uses `as any` in the
mocked `SupersetClient.get` response.
That directly violates the rule prohibiting `any` in new or modified
TypeScript/TSX code.
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=e42b0cdd7a9b403fb033dbfec39fa089&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=e42b0cdd7a9b403fb033dbfec39fa089&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/controls/DatasourceControl/DatasourceControl.test.tsx
**Line:** 268:274
**Comment:**
*Custom Rule: Replace this `any` cast with a concrete mocked response
type that matches the expected `SupersetClient.get` return shape for the
permissions branch.
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%2F39461&comment_hash=bab7be0ad62d6536738bded66e8a9941aff557dc60dbef12271e3c9781822153&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F39461&comment_hash=bab7be0ad62d6536738bded66e8a9941aff557dc60dbef12271e3c9781822153&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]