sadpandajoe commented on code in PR #44366:
URL: https://github.com/apache/superset/pull/44366#discussion_r4138811248


##########
superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/hooks/useFilterOperations.test.ts:
##########
@@ -256,3 +257,47 @@ test('restoreFilter cancels the pending removal before the 
delay elapses', () =>
 
   jest.useRealTimers();
 });
+
+function renderFilterOperations(
+  filters: Record<string, { filterType: string; dependencies?: string[] }>,
+) {
+  const params: FilterOperationsParams = {
+    form: {
+      getFieldValue: () => filters,
+    } as unknown as FilterOperationsParams['form'],
+    filterState: {
+      removedItems: {},
+    } as unknown as FilterOperationsParams['filterState'],
+    filterIds: Object.keys(filters),
+    filterConfigMap: {},
+    handleModifyItem: jest.fn(),
+    setActiveItem: jest.fn(),
+    setSaveAlertVisible: jest.fn(),
+  };
+  return renderHook(() => useFilterOperations(params)).result;
+}
+
+test('buildDependencyMap drops a parent id whose filter type no longer 
supports dependencies', () => {

Review Comment:
   The new callback also filters a parent that is pending removal, but this 
harness always uses `removedItems: {}`. A future refactor could preserve the 
type-change case while letting a pending parent remain in the live dependency 
map until save; could this add a `removedItems.parent` case that asserts the 
child maps to `[]`?



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