bito-code-review[bot] commented on code in PR #44154:
URL: https://github.com/apache/superset/pull/44154#discussion_r4163923818
##########
superset-frontend/src/utils/downloadAsImage.test.ts:
##########
@@ -69,13 +52,10 @@ const mockToJpeg = domToImage.toJpeg as jest.Mock;
const mockToPng = domToImage.toPng as jest.Mock;
const mockHtml2Canvas = html2canvas as jest.Mock;
const mockIsSafari = isSafari as jest.Mock;
-const mockAddWarningToast = addWarningToast as jest.Mock;
+// Passed explicitly to downloadAsImageOptimized below, mirroring how a real
+// caller supplies an already-bound `useToasts()` callback.
+const mockAddWarningToast = jest.fn();
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Incomplete toast-callback migration</b></div>
<div id="fix">
The toast-callback migration missed the Safari rejection test at line 1306:
it still calls `downloadAsImageOptimized('div', 'My Chart')` without passing
`mockAddWarningToast`, yet asserts
`expect(mockAddWarningToast).toHaveBeenCalledWith(...)`. Since
`addWarningToast` is now undefined there, `addWarningToast?.(...)` no-ops and
the assertion fails. Pass `mockAddWarningToast` as the 7th argument.
</div>
</div>
<small><i>Code Review Run #a4ce09</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]