rusackas commented on code in PR #37880:
URL: https://github.com/apache/superset/pull/37880#discussion_r3366529040
##########
superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndFilterSelect.test.tsx:
##########
@@ -41,16 +44,34 @@ import {
} from
'src/explore/components/controls/DndColumnSelectControl/DndFilterSelect';
import { PLACEHOLDER_DATASOURCE } from 'src/dashboard/constants';
import { ExpressionTypes } from '../FilterControl/types';
-import { Datasource } from '../../../types';
import { DndItemType } from '../../DndItemType';
-import DatasourcePanelDragOption from
'../../DatasourcePanel/DatasourcePanelDragOption';
+import { Datasource } from '../../../types';
+import {
+ CapturedDroppable,
+ captureDroppableData,
+ simulateDrop,
+} from './dndTestUtils';
jest.mock('src/core/editors', () => ({
EditorHost: ({ value }: { value: string }) => (
<div data-test="react-ace">{value}</div>
),
}));
+jest.mock('@dnd-kit/core', () => ({
+ ...jest.requireActual('@dnd-kit/core'),
+ useDroppable: jest.fn(),
+}));
+
+const captured: CapturedDroppable = { current: undefined };
+
+beforeEach(() => {
+ captured.current = undefined;
+ (useDroppable as jest.Mock).mockImplementation(
+ captureDroppableData(captured),
+ );
+});
Review Comment:
Good catch — fixed in 50a34ac. The two top-level `beforeEach` hooks ran in
registration order, so the second one (`jest.clearAllMocks()`) wiped the
`useDroppable`/`captureDroppableData` implementation installed by the first,
leaving `captured.current` undefined for the `simulateDrop` tests. I merged
them into a single `beforeEach` that clears mocks first and then installs the
mock implementation, so the captured droppable data is now populated for those
drop simulations.
--
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]