sadpandajoe commented on code in PR #43054:
URL: https://github.com/apache/superset/pull/43054#discussion_r3820267379
##########
superset-frontend/src/pages/AlertReportList/AlertReportList.test.tsx:
##########
@@ -44,6 +45,22 @@ jest.mock('src/utils/getBootstrapData', () => ({
})),
}));
+// Mock withToasts HOC to inject default toast functions while preserving
explicit test spies passed via props
+jest.mock('src/components/MessageToasts/withToasts', () => ({
+ __esModule: true,
+ default: <P extends object>(Component: React.ComponentType<P>) =>
+ function MockWithToasts(props: P) {
+ const mergedProps = {
+ addDangerToast: jest.fn(),
+ addSuccessToast: jest.fn(),
+ addInfoToast: jest.fn(),
+ addWarningToast: jest.fn(),
+ ...props,
+ } as P;
+ return <Component {...mergedProps} />;
Review Comment:
This still fails the frontend type check: `P` is not assignable to the
component's `LibraryManagedAttributes` props, so `lint-frontend` exits with
TS2322 on the current head. Could the mock avoid the generic spread or use a
type-safe wrapper that compiles?
##########
superset-frontend/src/pages/AlertReportList/index.tsx:
##########
@@ -191,23 +191,31 @@ function AlertList({
}
executingIdsRef.current.add(alertId);
+ const isReport = alert.type === 'Report';
executeReport(
alertId,
() => {
addSuccessToast(
- t('%(alertType)s "%(alertName)s" triggered successfully', {
- alertType: alert.type,
- alertName: alert.name,
- }),
+ isReport
+ ? t('Report "%(alertName)s" triggered successfully', {
Review Comment:
These new message IDs are not present in the translation catalogs, while the
replaced composed key is. That makes trigger toasts fall back to English for
existing non-English locales until catalogs are regenerated and translated.
Could this include the extracted catalog updates (or keep the existing
translated key until then)?
--
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]