You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/03/15 22:33:37 UTC

[GitHub] [superset] yardz opened a new pull request #13638: test: SelectAsyncControl

yardz opened a new pull request #13638:
URL: https://github.com/apache/superset/pull/13638


   ### SUMMARY
   Tests for SelectAsyncControl
   - Moved to own folder
   - Creating tests for the component
   
   ### TEST PLAN
   No behavior changes and the interface for importing was maintained.
   All tests must pass.
   
   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] codecov[bot] edited a comment on pull request #13638: test: SelectAsyncControl

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #13638:
URL: https://github.com/apache/superset/pull/13638#issuecomment-800303353


   # [Codecov](https://codecov.io/gh/apache/superset/pull/13638?src=pr&el=h1) Report
   > Merging [#13638](https://codecov.io/gh/apache/superset/pull/13638?src=pr&el=desc) (9ed7604) into [master](https://codecov.io/gh/apache/superset/commit/a35825de7b1c7dcbd4f407270c976ce5f18196dd?el=desc) (a35825d) will **decrease** coverage by `4.15%`.
   > The diff coverage is `33.33%`.
   
   > :exclamation: Current head 9ed7604 differs from pull request most recent head 508e979. Consider uploading reports for the commit 508e979 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/13638/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l)](https://codecov.io/gh/apache/superset/pull/13638?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #13638      +/-   ##
   ==========================================
   - Coverage   77.21%   73.05%   -4.16%     
   ==========================================
     Files         912      608     -304     
     Lines       46449    21638   -24811     
     Branches     5725     5723       -2     
   ==========================================
   - Hits        35866    15808   -20058     
   + Misses      10447     5694    -4753     
     Partials      136      136              
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | cypress | `56.56% <100.00%> (ø)` | |
   | hive | `?` | |
   | javascript | `63.09% <33.33%> (+0.04%)` | :arrow_up: |
   | postgres | `?` | |
   | presto | `?` | |
   | python | `?` | |
   | sqlite | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/13638?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [...nd/src/components/SupersetResourceSelect/index.tsx](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvU3VwZXJzZXRSZXNvdXJjZVNlbGVjdC9pbmRleC50c3g=) | `90.32% <ø> (ø)` | |
   | [...e/components/controls/SelectAsyncControl/index.jsx](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9TZWxlY3RBc3luY0NvbnRyb2wvaW5kZXguanN4) | `86.66% <ø> (ø)` | |
   | [...-frontend/src/explore/components/controls/index.js](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9pbmRleC5qcw==) | `100.00% <ø> (ø)` | |
   | [...frontend/src/views/CRUD/alert/AlertReportModal.tsx](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvYWxlcnQvQWxlcnRSZXBvcnRNb2RhbC50c3g=) | `56.00% <0.00%> (ø)` | |
   | [...perset-frontend/src/explore/components/Control.tsx](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9Db250cm9sLnRzeA==) | `95.45% <100.00%> (+0.21%)` | :arrow_up: |
   | [superset-frontend/src/views/CRUD/hooks.ts](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvaG9va3MudHM=) | `60.62% <100.00%> (ø)` | |
   | [...set-frontend/src/dashboard/util/getDropPosition.js](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC91dGlsL2dldERyb3BQb3NpdGlvbi5qcw==) | `90.90% <0.00%> (ø)` | |
   | [superset/datasets/commands/update.py](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGF0YXNldHMvY29tbWFuZHMvdXBkYXRlLnB5) | | |
   | [superset/models/sql\_types/presto\_sql\_types.py](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQvbW9kZWxzL3NxbF90eXBlcy9wcmVzdG9fc3FsX3R5cGVzLnB5) | | |
   | [...notation\_layers/annotations/commands/exceptions.py](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQvYW5ub3RhdGlvbl9sYXllcnMvYW5ub3RhdGlvbnMvY29tbWFuZHMvZXhjZXB0aW9ucy5weQ==) | | |
   | ... and [295 more](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/13638?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/13638?src=pr&el=footer). Last update [a35825d...508e979](https://codecov.io/gh/apache/superset/pull/13638?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] codecov[bot] edited a comment on pull request #13638: test: SelectAsyncControl

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #13638:
URL: https://github.com/apache/superset/pull/13638#issuecomment-800303353


   # [Codecov](https://codecov.io/gh/apache/superset/pull/13638?src=pr&el=h1) Report
   > Merging [#13638](https://codecov.io/gh/apache/superset/pull/13638?src=pr&el=desc) (24df782) into [master](https://codecov.io/gh/apache/superset/commit/a35825de7b1c7dcbd4f407270c976ce5f18196dd?el=desc) (a35825d) will **decrease** coverage by `0.03%`.
   > The diff coverage is `81.32%`.
   
   > :exclamation: Current head 24df782 differs from pull request most recent head 508e979. Consider uploading reports for the commit 508e979 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/13638/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l)](https://codecov.io/gh/apache/superset/pull/13638?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #13638      +/-   ##
   ==========================================
   - Coverage   77.21%   77.17%   -0.04%     
   ==========================================
     Files         912      935      +23     
     Lines       46449    47429     +980     
     Branches     5725     5943     +218     
   ==========================================
   + Hits        35866    36604     +738     
   - Misses      10447    10683     +236     
   - Partials      136      142       +6     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | cypress | `56.01% <50.95%> (-0.56%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/13638?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [...erset-frontend/src/SqlLab/components/SqlEditor.jsx](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL1NxbEVkaXRvci5qc3g=) | `56.01% <ø> (ø)` | |
   | [...et-frontend/src/SqlLab/components/TableElement.jsx](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL1RhYmxlRWxlbWVudC5qc3g=) | `88.37% <ø> (ø)` | |
   | [superset-frontend/src/chart/chartReducer.ts](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NoYXJ0L2NoYXJ0UmVkdWNlci50cw==) | `66.19% <ø> (+1.81%)` | :arrow_up: |
   | [...ontend/src/common/hooks/usePrevious/usePrevious.ts](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbW1vbi9ob29rcy91c2VQcmV2aW91cy91c2VQcmV2aW91cy50cw==) | `100.00% <ø> (ø)` | |
   | [...ontend/src/components/CertifiedIconWithTooltip.tsx](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvQ2VydGlmaWVkSWNvbldpdGhUb29sdGlwLnRzeA==) | `54.54% <0.00%> (-5.46%)` | :arrow_down: |
   | [...rset-frontend/src/components/ErrorMessage/types.ts](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvRXJyb3JNZXNzYWdlL3R5cGVzLnRz) | `100.00% <ø> (ø)` | |
   | [...nd/src/components/SupersetResourceSelect/index.tsx](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvU3VwZXJzZXRSZXNvdXJjZVNlbGVjdC9pbmRleC50c3g=) | `90.32% <ø> (ø)` | |
   | [...et-frontend/src/components/TableView/TableView.tsx](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvVGFibGVWaWV3L1RhYmxlVmlldy50c3g=) | `96.42% <ø> (ø)` | |
   | [...et-frontend/src/dashboard/actions/nativeFilters.ts](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9hY3Rpb25zL25hdGl2ZUZpbHRlcnMudHM=) | `60.00% <ø> (-4.11%)` | :arrow_down: |
   | [...end/src/dashboard/components/StickyVerticalBar.tsx](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL1N0aWNreVZlcnRpY2FsQmFyLnRzeA==) | `100.00% <ø> (ø)` | |
   | ... and [196 more](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/13638?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/13638?src=pr&el=footer). Last update [a35825d...508e979](https://codecov.io/gh/apache/superset/pull/13638?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] yardz commented on a change in pull request #13638: test: SelectAsyncControl

Posted by GitBox <gi...@apache.org>.
yardz commented on a change in pull request #13638:
URL: https://github.com/apache/superset/pull/13638#discussion_r600730801



##########
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:
       https://github.com/apache/superset/pull/13753#discussion_r600729737
   
   Just linking the same answer to "stay registered"




-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] codecov[bot] commented on pull request #13638: test: SelectAsyncControl

Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on pull request #13638:
URL: https://github.com/apache/superset/pull/13638#issuecomment-800303353


   # [Codecov](https://codecov.io/gh/apache/superset/pull/13638?src=pr&el=h1) Report
   > Merging [#13638](https://codecov.io/gh/apache/superset/pull/13638?src=pr&el=desc) (9ed7604) into [master](https://codecov.io/gh/apache/superset/commit/a35825de7b1c7dcbd4f407270c976ce5f18196dd?el=desc) (a35825d) will **decrease** coverage by `4.15%`.
   > The diff coverage is `33.33%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/13638/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l)](https://codecov.io/gh/apache/superset/pull/13638?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #13638      +/-   ##
   ==========================================
   - Coverage   77.21%   73.05%   -4.16%     
   ==========================================
     Files         912      608     -304     
     Lines       46449    21638   -24811     
     Branches     5725     5723       -2     
   ==========================================
   - Hits        35866    15808   -20058     
   + Misses      10447     5694    -4753     
     Partials      136      136              
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | cypress | `56.56% <100.00%> (ø)` | |
   | hive | `?` | |
   | javascript | `63.09% <33.33%> (+0.04%)` | :arrow_up: |
   | postgres | `?` | |
   | presto | `?` | |
   | python | `?` | |
   | sqlite | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/13638?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [...nd/src/components/SupersetResourceSelect/index.tsx](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvU3VwZXJzZXRSZXNvdXJjZVNlbGVjdC9pbmRleC50c3g=) | `90.32% <ø> (ø)` | |
   | [...e/components/controls/SelectAsyncControl/index.jsx](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9TZWxlY3RBc3luY0NvbnRyb2wvaW5kZXguanN4) | `86.66% <ø> (ø)` | |
   | [...-frontend/src/explore/components/controls/index.js](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9pbmRleC5qcw==) | `100.00% <ø> (ø)` | |
   | [...frontend/src/views/CRUD/alert/AlertReportModal.tsx](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvYWxlcnQvQWxlcnRSZXBvcnRNb2RhbC50c3g=) | `56.00% <0.00%> (ø)` | |
   | [...perset-frontend/src/explore/components/Control.tsx](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9Db250cm9sLnRzeA==) | `95.45% <100.00%> (+0.21%)` | :arrow_up: |
   | [superset-frontend/src/views/CRUD/hooks.ts](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvaG9va3MudHM=) | `60.62% <100.00%> (ø)` | |
   | [...set-frontend/src/dashboard/util/getDropPosition.js](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC91dGlsL2dldERyb3BQb3NpdGlvbi5qcw==) | `90.90% <0.00%> (ø)` | |
   | [...uperset/utils/dashboard\_filter\_scopes\_converter.py](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdXRpbHMvZGFzaGJvYXJkX2ZpbHRlcl9zY29wZXNfY29udmVydGVyLnB5) | | |
   | [superset/examples/deck.py](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZXhhbXBsZXMvZGVjay5weQ==) | | |
   | [superset/dashboards/api.py](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGFzaGJvYXJkcy9hcGkucHk=) | | |
   | ... and [295 more](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/13638?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/13638?src=pr&el=footer). Last update [a35825d...8047a43](https://codecov.io/gh/apache/superset/pull/13638?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] yardz commented on a change in pull request #13638: test: SelectAsyncControl

Posted by GitBox <gi...@apache.org>.
yardz commented on a change in pull request #13638:
URL: https://github.com/apache/superset/pull/13638#discussion_r600734118



##########
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:
       Yes, normally I do this, but in the case of this test (And others similar to this), I thought it would be clearer to keep the `test-id` with the same name as the component.
   This will make it clearer at the time of reading and will also help with other tests to identify which html of this component. 
   
   When the HTML is very large it is very hard to find the limits between the components.




-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] codecov[bot] edited a comment on pull request #13638: test: SelectAsyncControl

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #13638:
URL: https://github.com/apache/superset/pull/13638#issuecomment-800303353


   # [Codecov](https://codecov.io/gh/apache/superset/pull/13638?src=pr&el=h1) Report
   > Merging [#13638](https://codecov.io/gh/apache/superset/pull/13638?src=pr&el=desc) (24df782) into [master](https://codecov.io/gh/apache/superset/commit/a35825de7b1c7dcbd4f407270c976ce5f18196dd?el=desc) (a35825d) will **decrease** coverage by `0.03%`.
   > The diff coverage is `81.32%`.
   
   > :exclamation: Current head 24df782 differs from pull request most recent head 508e979. Consider uploading reports for the commit 508e979 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/13638/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l)](https://codecov.io/gh/apache/superset/pull/13638?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #13638      +/-   ##
   ==========================================
   - Coverage   77.21%   77.17%   -0.04%     
   ==========================================
     Files         912      935      +23     
     Lines       46449    47429     +980     
     Branches     5725     5943     +218     
   ==========================================
   + Hits        35866    36604     +738     
   - Misses      10447    10683     +236     
   - Partials      136      142       +6     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | cypress | `56.01% <50.95%> (-0.56%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/13638?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [...erset-frontend/src/SqlLab/components/SqlEditor.jsx](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL1NxbEVkaXRvci5qc3g=) | `56.01% <ø> (ø)` | |
   | [...et-frontend/src/SqlLab/components/TableElement.jsx](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL1RhYmxlRWxlbWVudC5qc3g=) | `88.37% <ø> (ø)` | |
   | [superset-frontend/src/chart/chartReducer.ts](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NoYXJ0L2NoYXJ0UmVkdWNlci50cw==) | `66.19% <ø> (+1.81%)` | :arrow_up: |
   | [...ontend/src/common/hooks/usePrevious/usePrevious.ts](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbW1vbi9ob29rcy91c2VQcmV2aW91cy91c2VQcmV2aW91cy50cw==) | `100.00% <ø> (ø)` | |
   | [...ontend/src/components/CertifiedIconWithTooltip.tsx](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvQ2VydGlmaWVkSWNvbldpdGhUb29sdGlwLnRzeA==) | `54.54% <0.00%> (-5.46%)` | :arrow_down: |
   | [...rset-frontend/src/components/ErrorMessage/types.ts](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvRXJyb3JNZXNzYWdlL3R5cGVzLnRz) | `100.00% <ø> (ø)` | |
   | [...nd/src/components/SupersetResourceSelect/index.tsx](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvU3VwZXJzZXRSZXNvdXJjZVNlbGVjdC9pbmRleC50c3g=) | `90.32% <ø> (ø)` | |
   | [...et-frontend/src/components/TableView/TableView.tsx](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvVGFibGVWaWV3L1RhYmxlVmlldy50c3g=) | `96.42% <ø> (ø)` | |
   | [...et-frontend/src/dashboard/actions/nativeFilters.ts](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9hY3Rpb25zL25hdGl2ZUZpbHRlcnMudHM=) | `60.00% <ø> (-4.11%)` | :arrow_down: |
   | [...end/src/dashboard/components/StickyVerticalBar.tsx](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL1N0aWNreVZlcnRpY2FsQmFyLnRzeA==) | `100.00% <ø> (ø)` | |
   | ... and [196 more](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/13638?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/13638?src=pr&el=footer). Last update [a35825d...508e979](https://codecov.io/gh/apache/superset/pull/13638?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] rusackas merged pull request #13638: test: SelectAsyncControl

Posted by GitBox <gi...@apache.org>.
rusackas merged pull request #13638:
URL: https://github.com/apache/superset/pull/13638


   


-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] michael-s-molina commented on a change in pull request #13638: test: SelectAsyncControl

Posted by GitBox <gi...@apache.org>.
michael-s-molina commented on a change in pull request #13638:
URL: https://github.com/apache/superset/pull/13638#discussion_r596900559



##########
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 = {

Review comment:
       `beforeEach` is already initializing this variable.
   
   `let defaultProps;` or `let defaultProps = {};`




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] yardz commented on a change in pull request #13638: test: SelectAsyncControl

Posted by GitBox <gi...@apache.org>.
yardz commented on a change in pull request #13638:
URL: https://github.com/apache/superset/pull/13638#discussion_r601672784



##########
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:
       done by factory: https://github.com/apache/superset/pull/13753#discussion_r600862661




-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] codecov[bot] edited a comment on pull request #13638: test: SelectAsyncControl

Posted by GitBox <gi...@apache.org>.
codecov[bot] edited a comment on pull request #13638:
URL: https://github.com/apache/superset/pull/13638#issuecomment-800303353


   # [Codecov](https://codecov.io/gh/apache/superset/pull/13638?src=pr&el=h1) Report
   > Merging [#13638](https://codecov.io/gh/apache/superset/pull/13638?src=pr&el=desc) (0db742b) into [master](https://codecov.io/gh/apache/superset/commit/a35825de7b1c7dcbd4f407270c976ce5f18196dd?el=desc) (a35825d) will **decrease** coverage by `3.82%`.
   > The diff coverage is `78.66%`.
   
   > :exclamation: Current head 0db742b differs from pull request most recent head 508e979. Consider uploading reports for the commit 508e979 to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/13638/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l)](https://codecov.io/gh/apache/superset/pull/13638?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #13638      +/-   ##
   ==========================================
   - Coverage   77.21%   73.39%   -3.83%     
   ==========================================
     Files         912      621     -291     
     Lines       46449    22073   -24376     
     Branches     5725     5740      +15     
   ==========================================
   - Hits        35866    16200   -19666     
   + Misses      10447     5729    -4718     
   - Partials      136      144       +8     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | cypress | `56.02% <49.93%> (-0.55%)` | :arrow_down: |
   | hive | `?` | |
   | javascript | `63.65% <71.98%> (+0.60%)` | :arrow_up: |
   | postgres | `?` | |
   | presto | `?` | |
   | python | `?` | |
   | sqlite | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/13638?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [...rset-frontend/src/SqlLab/components/QueryTable.jsx](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL1F1ZXJ5VGFibGUuanN4) | `66.66% <ø> (ø)` | |
   | [...erset-frontend/src/SqlLab/components/SqlEditor.jsx](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL1NxbEVkaXRvci5qc3g=) | `56.01% <ø> (ø)` | |
   | [...et-frontend/src/SqlLab/components/TableElement.jsx](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL1RhYmxlRWxlbWVudC5qc3g=) | `88.37% <ø> (ø)` | |
   | [superset-frontend/src/chart/chartReducer.ts](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NoYXJ0L2NoYXJ0UmVkdWNlci50cw==) | `66.19% <ø> (+1.81%)` | :arrow_up: |
   | [...ontend/src/common/hooks/usePrevious/usePrevious.ts](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbW1vbi9ob29rcy91c2VQcmV2aW91cy91c2VQcmV2aW91cy50cw==) | `100.00% <ø> (ø)` | |
   | [...ontend/src/components/CertifiedIconWithTooltip.tsx](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvQ2VydGlmaWVkSWNvbldpdGhUb29sdGlwLnRzeA==) | `54.54% <0.00%> (-5.46%)` | :arrow_down: |
   | [...rset-frontend/src/components/ErrorMessage/types.ts](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvRXJyb3JNZXNzYWdlL3R5cGVzLnRz) | `100.00% <ø> (ø)` | |
   | [...rset-frontend/src/components/ProgressBar/index.tsx](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvUHJvZ3Jlc3NCYXIvaW5kZXgudHN4) | `100.00% <ø> (ø)` | |
   | [...nd/src/components/SupersetResourceSelect/index.tsx](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvU3VwZXJzZXRSZXNvdXJjZVNlbGVjdC9pbmRleC50c3g=) | `90.32% <ø> (ø)` | |
   | [...et-frontend/src/components/TableView/TableView.tsx](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvVGFibGVWaWV3L1RhYmxlVmlldy50c3g=) | `96.42% <ø> (ø)` | |
   | ... and [407 more](https://codecov.io/gh/apache/superset/pull/13638/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/13638?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/13638?src=pr&el=footer). Last update [a35825d...508e979](https://codecov.io/gh/apache/superset/pull/13638?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] yardz commented on a change in pull request #13638: test: SelectAsyncControl

Posted by GitBox <gi...@apache.org>.
yardz commented on a change in pull request #13638:
URL: https://github.com/apache/superset/pull/13638#discussion_r596981741



##########
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 = {

Review comment:
       For typing. If don't put it that way, the type will be `any` or `{}`.




-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] yardz closed pull request #13638: test: SelectAsyncControl

Posted by GitBox <gi...@apache.org>.
yardz closed pull request #13638:
URL: https://github.com/apache/superset/pull/13638


   


-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] yardz commented on a change in pull request #13638: test: SelectAsyncControl

Posted by GitBox <gi...@apache.org>.
yardz commented on a change in pull request #13638:
URL: https://github.com/apache/superset/pull/13638#discussion_r601672523



##########
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 = {

Review comment:
       done by factory: https://github.com/apache/superset/pull/13753#discussion_r600862661




-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] geido commented on a change in pull request #13638: test: SelectAsyncControl

Posted by GitBox <gi...@apache.org>.
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] yardz commented on a change in pull request #13638: test: SelectAsyncControl

Posted by GitBox <gi...@apache.org>.
yardz commented on a change in pull request #13638:
URL: https://github.com/apache/superset/pull/13638#discussion_r600734118



##########
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:
       Yes, normally I do this, but in the case of this test (And others similar to this), I thought it would be clearer to keep the `test-id` with the same name as the component.
   This will make it clearer at the time of reading and will also help with other tests to identify which html of this component. 
   
   When the HTML is large it is very hard to find the limits between the components.




-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] rusackas commented on a change in pull request #13638: test: SelectAsyncControl

Posted by GitBox <gi...@apache.org>.
rusackas commented on a change in pull request #13638:
URL: https://github.com/apache/superset/pull/13638#discussion_r602018977



##########
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:
       I'm on the fence here... but I'm OK with it as long as the data-test attr is at the outer element of the component like it is here, and represents the entirety of the component. Little pieces within the component, like `subscribe-button` or whatever, should folow the convention.




-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org