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


##########
superset-frontend/plugins/preset-chart-deckgl/src/components/DeckGLOverlayMapLibre.test.tsx:
##########
@@ -0,0 +1,80 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { render } from '@testing-library/react';
+import '@testing-library/jest-dom';
+import type { Layer } from '@deck.gl/core';
+import type { MapLibreOverlay } from '@deck.gl/maplibre';
+import DeckGLOverlayMapLibre from './DeckGLOverlayMapLibre';
+
+const setProps = jest.fn();
+const mockOverlay = { setProps } as unknown as MapLibreOverlay;
+const MockMapLibreOverlay = jest.fn((..._args: unknown[]) => mockOverlay);
+
+jest.mock('react-map-gl/maplibre', () => {
+  const { useState } = jest.requireActual('react');
+  // Mirrors real useControl's lazy-initialize-once behavior (useState's
+  // initializer only runs on mount), so re-renders don't reconstruct the
+  // overlay - only the component's own setProps call should run per render.
+  return {
+    useControl: (factory: () => unknown) => useState(factory)[0],
+  };
+});
+
+jest.mock('@deck.gl/maplibre', () => ({

Review Comment:
   These tests mock both `react-map-gl/maplibre`'s `useControl` and 
`@deck.gl/maplibre` itself, so none of them ever attach a real 
`MapLibreOverlay` to an actual MapLibre 6 map — the exact compatibility 
boundary this migration exists to prove out. A regression in that attachment 
path (the class of `onAdd`-level incompatibility the deleted 
`mapLibreVersionPin.test.ts` used to guard against) would leave all three tests 
green. Could one of them render the overlay against a real `maplibre-gl` `Map` 
(or an unmocked `MapLibreOverlay`) instead of a fully mocked one, so the 
migration gets coverage against the real MapLibre 6 API surface?



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