KHARSHAVARDHAN-eng commented on code in PR #42618:
URL: https://github.com/apache/superset/pull/42618#discussion_r3685105247


##########
superset-frontend/src/pages/AlertReportList/AlertReportList.test.tsx:
##########
@@ -593,3 +593,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 });

Review Comment:
   Thanks for catching this! You're right that the  HOC was replacing the 
mocked toast props, so the spies never received the calls. I've updated the 
tests to mock  as a passthrough, following the existing testing pattern used 
elsewhere in the repository. The mocked toast props are now preserved, so the 
assertions exercise the intended behavior. I'd appreciate another look when you 
have a chance.



##########
superset-frontend/src/pages/AlertReportList/AlertReportList.test.tsx:
##########
@@ -593,3 +593,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 });

Review Comment:
   Thanks for catching this! You're right that the `withToasts` HOC was 
replacing the mocked toast props, so the spies never received the calls. I've 
updated the tests to mock `withToasts` as a passthrough, following the existing 
testing pattern used elsewhere in the repository. The mocked toast props are 
now preserved, so the assertions exercise the intended behavior. I'd appreciate 
another look when you have a chance.



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