geido commented on a change in pull request #13638:
URL: https://github.com/apache/superset/pull/13638#discussion_r600578064



##########
File path: 
superset-frontend/src/explore/components/controls/SelectAsyncControl/SelectAsyncControl.test.tsx
##########
@@ -0,0 +1,117 @@
+/**
+ * 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 userEvent from '@testing-library/user-event';
+import React from 'react';
+import { render, screen } from 'spec/helpers/testing-library';
+import SelectAsyncControl from '.';
+
+jest.mock('src/components/AsyncSelect', () => ({
+  __esModule: true,
+  default: (props: any) => (
+    <div
+      data-test="select-test"
+      data-data-endpoint={props.dataEndpoint}
+      data-value={JSON.stringify(props.value)}
+      data-placeholder={props.placeholder}
+      data-multi={props.multi ? 'true' : 'false'}
+    >
+      <button
+        type="button"
+        onClick={() => props.onChange(props.multi ? [] : {})}
+      >
+        onChange
+      </button>
+      <button type="button" onClick={() => props.mutator()}>
+        mutator
+      </button>
+
+      <div data-test="valueRenderer">
+        {props.valueRenderer({ label: 'valueRenderer' })}
+      </div>
+    </div>
+  ),
+}));
+
+let defaultProps = {
+  value: [],
+  dataEndpoint: 'api/v1/dataset/related/owners',
+  multi: true,
+  onAsyncErrorMessage: 'Error while fetching data',
+  placeholder: 'Select ...',
+  onChange: jest.fn(),
+  mutator: jest.fn(),
+};
+
+beforeEach(() => {
+  jest.resetAllMocks();
+  defaultProps = {

Review comment:
       I think the same comment as the previous PRs. No need to replace the 
entire props

##########
File path: 
superset-frontend/src/explore/components/controls/SelectAsyncControl/index.jsx
##########
@@ -68,7 +68,7 @@ const SelectAsyncControl = props => {
   };
 
   return (
-    <div>
+    <div data-test="SelectAsyncControl">

Review comment:
       Small nit again about the naming convention being with hyphens or just 
one word lowercase




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

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