rusackas commented on code in PR #41511:
URL: https://github.com/apache/superset/pull/41511#discussion_r3493498881
##########
superset-frontend/plugins/plugin-chart-cartodiagram/src/components/OlChartMap.tsx:
##########
@@ -24,7 +24,7 @@ import { View } from 'ol';
import BaseEvent from 'ol/events/Event';
import { unByKey } from 'ol/Observable';
import { toLonLat } from 'ol/proj';
-import { debounce } from 'lodash';
+import { debounce } from 'lodash-es';
Review Comment:
Not dead — the import is used down in the zoom effect (line 305). The local
`debounce` only shadows inside the first effect, and eslint would have flagged
it otherwise.
##########
superset-frontend/src/components/Chart/DrillBy/DrillBySubmenu.test.tsx:
##########
@@ -37,11 +37,14 @@ import { DrillBySubmenu, DrillBySubmenuProps } from
'./DrillBySubmenu';
const { form_data: defaultFormData } = chartQueries[sliceId];
-jest.mock('lodash/debounce', () => (fn: Function & { debounce: Function }) => {
- // eslint-disable-next-line no-param-reassign
- fn.debounce = jest.fn();
- return fn;
-});
+jest.mock('lodash', () => ({
+ ...jest.requireActual('lodash'),
+ debounce: (fn: Function & { debounce: Function }) => {
+ // eslint-disable-next-line no-param-reassign
+ fn.debounce = jest.fn();
+ return fn;
+ },
+}));
Review Comment:
`jest.config.js` aliases `^lodash-es$` to the CJS lodash build
(moduleNameMapper), so mocking `lodash` still intercepts the import. Working as
intended.
##########
superset-frontend/src/explore/components/ExploreViewContainer/ExploreViewContainer.test.tsx:
##########
@@ -104,9 +104,9 @@ jest.mock(
}),
);
-jest.mock('lodash/debounce', () => ({
- __esModule: true,
- default: (fuc: Function) => fuc,
+jest.mock('lodash', () => ({
Review Comment:
`jest.config.js` aliases `^lodash-es$` to the CJS lodash build
(moduleNameMapper), so mocking `lodash` still intercepts the import. Working as
intended.
##########
superset-frontend/src/explore/components/DataTableControl/FilterInput.test.tsx:
##########
@@ -19,9 +19,9 @@
import { render, screen, userEvent } from 'spec/helpers/testing-library';
import { FilterInput } from '.';
-jest.mock('lodash/debounce', () => ({
- __esModule: true,
- default: (fuc: Function) => fuc,
+jest.mock('lodash', () => ({
Review Comment:
`jest.config.js` aliases `^lodash-es$` to the CJS lodash build
(moduleNameMapper), so mocking `lodash` still intercepts the import. Working as
intended.
--
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]