aminghadersohi commented on code in PR #44851:
URL: https://github.com/apache/superset/pull/44851#discussion_r4201518523


##########
superset-frontend/src/explore/components/ExploreViewContainer/ExploreViewContainer.test.tsx:
##########
@@ -860,6 +860,79 @@ function setupTableChartControlPanel() {
   });
 }
 
+test('clearing a singleton metric refreshes semantic compatibility after 
metadata sync', async () => {
+  const fetchCompatibilitySpy = jest.spyOn(
+    exploreActions,
+    'fetchCompatibility',
+  );
+  const endpoint = 'path:/api/v1/datasource/semantic_view/7/compatible';
+  fetchMock.post(endpoint, {
+    result: {
+      compatible_metrics: ['metric_a', 'metric_b'],
+      compatible_dimensions: [],
+    },
+  });
+  const initialState = {
+    ...reduxState,
+    explore: {
+      ...reduxState.explore,
+      datasource: {
+        ...reduxState.explore.datasource,
+        id: 7,
+        type: 'semantic_view',
+      },
+      form_data: {
+        datasource: '7__semantic_view',
+        viz_type: VizType.BigNumberTotal,
+        metric: 'metric_a',
+      },
+      controls: {
+        datasource: { value: '7__semantic_view' },
+        viz_type: { value: VizType.BigNumberTotal },
+        metric: { value: 'metric_a' },
+      },
+    },
+  };
+  const store = createStore(initialState, reducerIndex);
+  renderWithRouter({ initialState, store });
+  await waitFor(() =>
+    expect(store.getState()).toMatchObject({
+      explore: { compatibility: { status: 'verified' } },
+    }),
+  );
+  // Model the completed sync answer: metric B cannot combine with metric A.
+  act(() => {
+    store.dispatch(
+      exploreActions.setCompatibility({
+        status: 'verified',
+        metrics: ['metric_a'],
+        dimensions: [],
+      }),
+    );
+  });
+  fetchCompatibilitySpy.mockClear();

Review Comment:
   Verified at 9c6e071050: dropping `formData.metric` from 
`getCompatibilitySelection` now fails this test at :904. Resolving.



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