rusackas commented on code in PR #37625:
URL: https://github.com/apache/superset/pull/37625#discussion_r2770118154


##########
superset-frontend/src/dashboard/reducers/dashboardState.test.ts:
##########
@@ -63,7 +83,7 @@ describe('DashboardState reducer', () => {
         dashboardLayout: { present: { tab1: { parents: [] } } },
       });
       const request = setActiveTab('tab1');
-      const thunkAction = request(store.dispatch, store.getState);
+      const thunkAction = request(store.dispatch, store.getState as any);

Review Comment:
   The issue is that the mock store's `getState` returns a partial state object 
(just `dashboardState` and `dashboardLayout`), not a full `RootState`. Casting 
to `() => RootState` would be a more specific lie than `any`, but it's still 
inaccurate since the state is intentionally partial. In test files, `as any` is 
the pragmatic pattern for partial mocks — it documents that we're deliberately 
bypassing type checking for the mock. That said, using `as () => RootState` 
would be slightly more descriptive. Happy to change if you prefer.



##########
superset-frontend/src/dashboard/reducers/dashboardState.test.ts:
##########
@@ -117,10 +137,10 @@ describe('DashboardState reducer', () => {
         }),
       );
       request = setActiveTab('TAB-2', 'TAB-1');
-      thunkAction = request(store.dispatch, () => ({
+      thunkAction = request(store.dispatch, (() => ({
         ...(store.getState() as object),
-        dashboardState: result,
-      }));
+        dashboardState: result as DashboardState,
+      })) as any);
       result = typedDashboardStateReducer(result, thunkAction);

Review Comment:
   Same reasoning as above.



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