sadpandajoe commented on code in PR #42618:
URL: https://github.com/apache/superset/pull/42618#discussion_r3686715477
##########
superset-frontend/src/pages/AlertReportList/AlertReportList.test.tsx:
##########
@@ -593,3 +599,99 @@ test('trigger-now action does not duplicate in-flight
requests', async () => {
expect(fetchMock.callHistory.calls('execute-report-slow')).toHaveLength(1);
});
});
+
+test('trigger-now action displays correct success toast for Alert', async ()
=> {
+ const addSuccessToast = jest.fn();
+ fetchMock.post(
+ 'glob:*/api/v1/report/*/execute',
+ {
+ execution_id: 'f47ac10b-58cc-4372-a567-0e02b2c3d479',
+ message: 'Triggered',
+ },
+ { name: 'execute-alert-success' },
+ );
+
+ renderAlertList({ addSuccessToast });
+ await screen.findByText('Weekly Sales Alert');
+
+ const triggerButtons = screen.getAllByTestId('trigger-now-action');
+ fireEvent.click(triggerButtons[0]);
+
+ await waitFor(() => {
+ expect(addSuccessToast).toHaveBeenCalledWith(
+ 'Alert "Weekly Sales Alert" triggered successfully',
+ );
+ });
Review Comment:
These success assertions also pass against the old interpolation because its
English output is identical, so they do not protect the localization behavior
this change fixes. Could this boundary assert the dedicated Alert/Report msgid
(or use distinct test translations) so reverting to `%(alertType)s` makes the
test fail?
--
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]