msyavuz commented on code in PR #43453:
URL: https://github.com/apache/superset/pull/43453#discussion_r3881426556


##########
superset-frontend/package.json:
##########
@@ -146,7 +146,6 @@
     "@superset-ui/plugin-chart-world-map": 
"file:./plugins/plugin-chart-world-map",
     "@superset-ui/preset-chart-deckgl": "file:./plugins/preset-chart-deckgl",
     "@superset-ui/switchboard": "file:./packages/superset-ui-switchboard",
-    "@types/d3-format": "^3.0.1",
     "@types/d3-selection": "^3.0.11",

Review Comment:
   `src/setup/setupFormatters.ts` and `src/types/bootstrapTypes.ts` still 
import `FormatLocaleDefinition` from `d3-format`, so dropping 
`@types/d3-format` leaves root typing riding on hoisting from 
superset-ui-core's devDep (and the lockfile wasn't regenerated) — keep the 
entry?



##########
superset-frontend/src/components/Datasource/components/DatasourceEditor/tests/DatasourceEditorMetricFormatWarning.test.tsx:
##########
@@ -0,0 +1,173 @@
+/**
+ * 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 fetchMock from 'fetch-mock';
+import { screen, userEvent, within } from 'spec/helpers/testing-library';
+import { Constants } from '@superset-ui/core/components';
+import { isCountExpression, isPercentD3Format } from '../DatasourceEditor';
+import {
+  createProps,
+  DATASOURCE_ENDPOINT,
+  setupDatasourceEditorMocks,
+  cleanupAsyncOperations,
+  fastRender,
+  dismissDatasourceWarning,
+} from './DatasourceEditor.test.utils';
+
+beforeEach(() => {
+  fetchMock.get(DATASOURCE_ENDPOINT, [], { name: DATASOURCE_ENDPOINT });
+  setupDatasourceEditorMocks();
+});
+
+afterEach(async () => {
+  await cleanupAsyncOperations();
+  fetchMock.clearHistory().removeRoutes();
+});
+
+const WARNING_TEXT = /D3 format is a percentage/i;
+
+// Selecting the expand toggle by its position in the list is brittle: any
+// change to the fixture or the table's sort order would expand a different
+// row and negative assertions would keep passing against the wrong metric.
+// Look up the toggle via the row that actually contains the metric name.
+const expandMetricRow = async (metricName: string) => {
+  const nameCell = await screen.findByText(metricName);
+  const row = nameCell.closest('tr');
+  if (!row) {
+    throw new Error(`Could not find a table row for metric "${metricName}"`);
+  }
+  await userEvent.click(within(row).getByLabelText(/expand row/i));
+};
+
+// Negative assertions must wait past TextControl's debounce, or they pass
+// before the value even commits.
+const waitPastDebounce = () =>
+  new Promise(resolve => {
+    setTimeout(resolve, Constants.FAST_DEBOUNCE + 50);

Review Comment:
   `FAST_DEBOUNCE + 50` is thin headroom on a loaded runner: if the debounced 
onChange lands after the sleep, all four "does not warn" cases pass vacuously — 
assert the committed input value first, then absence?



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