You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "lyndsiWilliams (via GitHub)" <gi...@apache.org> on 2023/01/30 23:52:52 UTC
[GitHub] [superset] lyndsiWilliams opened a new pull request, #22915: test: Clean up AdhocFilterOption test warnings
lyndsiWilliams opened a new pull request, #22915:
URL: https://github.com/apache/superset/pull/22915
<!---
Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/
Example:
fix(dashboard): load charts correctly
-->
### SUMMARY
<!--- Describe the change below, including rationale and design decisions -->
This PR fixes 5 warnings in `superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterOption/AdhocFilterOption.test.tsx`. There was one act error and the other four were because the tests needed a redux provider. I also changed the tests to use `useDnd` from our test helper's `render` function instead of wrapping the provider in the setup function.
### TESTING INSTRUCTIONS
<!--- Required! What steps can be taken to manually verify the changes? -->
- cd into `superset-frontend`
- run `npm run test superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterOption/AdhocFilterOption.test.tsx`
- Observe that only one warning is left in the test.
- There were 6 warnings initially
### ADDITIONAL INFORMATION
<!--- Check any relevant boxes with "x" -->
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
--
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: notifications-unsubscribe@superset.apache.org
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] lyndsiWilliams commented on a diff in pull request #22915: test: Clean up AdhocFilterOption test warnings
Posted by "lyndsiWilliams (via GitHub)" <gi...@apache.org>.
lyndsiWilliams commented on code in PR #22915:
URL: https://github.com/apache/superset/pull/22915#discussion_r1091287474
##########
superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterOption/AdhocFilterOption.test.tsx:
##########
@@ -19,14 +19,35 @@
import React from 'react';
import { render, screen, waitFor } from 'spec/helpers/testing-library';
import userEvent from '@testing-library/user-event';
-import { HTML5Backend } from 'react-dnd-html5-backend';
-import { DndProvider } from 'react-dnd';
import AdhocFilter, {
EXPRESSION_TYPES,
CLAUSES,
} from 'src/explore/components/controls/FilterControl/AdhocFilter';
import AdhocFilterOption, { AdhocFilterOptionProps } from '.';
+jest.mock('src/components/Icons/Icon', () => ({
+ __esModule: true,
+ default: ({
+ fileName,
+ role,
+ iconColor,
+ ...rest
+ }: {
+ fileName: string;
+ role: string;
+ iconColor: string;
+ }) => (
+ <span
+ role={role ?? 'img'}
+ aria-label={fileName.replace('_', '-')}
+ // @ts-ignore
Review Comment:
This is to prevent the following warning in the test:
>Warning: React does not recognize the `iconColor` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `iconcolor` instead. If you accidentally passed it from a parent component, remove it from the DOM element.
in span (created by default)
...
This seemed arbitrary to the functionality in this instance so I felt it was safe to ignore.
--
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: notifications-unsubscribe@superset.apache.org
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] lyndsiWilliams commented on a diff in pull request #22915: test: Clean up AdhocFilterOption test warnings
Posted by "lyndsiWilliams (via GitHub)" <gi...@apache.org>.
lyndsiWilliams commented on code in PR #22915:
URL: https://github.com/apache/superset/pull/22915#discussion_r1091287474
##########
superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterOption/AdhocFilterOption.test.tsx:
##########
@@ -19,14 +19,35 @@
import React from 'react';
import { render, screen, waitFor } from 'spec/helpers/testing-library';
import userEvent from '@testing-library/user-event';
-import { HTML5Backend } from 'react-dnd-html5-backend';
-import { DndProvider } from 'react-dnd';
import AdhocFilter, {
EXPRESSION_TYPES,
CLAUSES,
} from 'src/explore/components/controls/FilterControl/AdhocFilter';
import AdhocFilterOption, { AdhocFilterOptionProps } from '.';
+jest.mock('src/components/Icons/Icon', () => ({
+ __esModule: true,
+ default: ({
+ fileName,
+ role,
+ iconColor,
+ ...rest
+ }: {
+ fileName: string;
+ role: string;
+ iconColor: string;
+ }) => (
+ <span
+ role={role ?? 'img'}
+ aria-label={fileName.replace('_', '-')}
+ // @ts-ignore
Review Comment:
This is to prevent the following warning in the test:
>Warning: React does not recognize the `iconColor` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `iconcolor` instead. If you accidentally passed it from a parent component, remove it from the DOM element.
in span (created by default)
...
This seemed arbitrary to the functionality so I felt it was safe to ignore.
--
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: notifications-unsubscribe@superset.apache.org
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 diff in pull request #22915: test: Clean up AdhocFilterOption test warnings
Posted by "michael-s-molina (via GitHub)" <gi...@apache.org>.
michael-s-molina commented on code in PR #22915:
URL: https://github.com/apache/superset/pull/22915#discussion_r1093731395
##########
superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterOption/AdhocFilterOption.test.tsx:
##########
@@ -19,14 +19,35 @@
import React from 'react';
import { render, screen, waitFor } from 'spec/helpers/testing-library';
import userEvent from '@testing-library/user-event';
-import { HTML5Backend } from 'react-dnd-html5-backend';
-import { DndProvider } from 'react-dnd';
import AdhocFilter, {
EXPRESSION_TYPES,
CLAUSES,
} from 'src/explore/components/controls/FilterControl/AdhocFilter';
import AdhocFilterOption, { AdhocFilterOptionProps } from '.';
+jest.mock('src/components/Icons/Icon', () => ({
+ __esModule: true,
+ default: ({
+ fileName,
+ role,
+ iconColor,
+ ...rest
+ }: {
+ fileName: string;
+ role: string;
+ iconColor: string;
+ }) => (
+ <span
+ role={role ?? 'img'}
+ aria-label={fileName.replace('_', '-')}
+ // @ts-ignore
Review Comment:
The `iconColor` or the `rest` props are not used in the tests so it should be safe to remove them when mocking.
You can use this code and the tests will remain green:
```
jest.mock('src/components/Icons/Icon', () => ({
__esModule: true,
default: ({ fileName, role }: { fileName: string; role: string }) => (
<span role={role ?? 'img'} aria-label={fileName.replace('_', '-')} />
),
StyledIcon: () => <span />,
}));
```
--
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: notifications-unsubscribe@superset.apache.org
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] lyndsiWilliams commented on a diff in pull request #22915: test: Clean up AdhocFilterOption test warnings
Posted by "lyndsiWilliams (via GitHub)" <gi...@apache.org>.
lyndsiWilliams commented on code in PR #22915:
URL: https://github.com/apache/superset/pull/22915#discussion_r1091287474
##########
superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterOption/AdhocFilterOption.test.tsx:
##########
@@ -19,14 +19,35 @@
import React from 'react';
import { render, screen, waitFor } from 'spec/helpers/testing-library';
import userEvent from '@testing-library/user-event';
-import { HTML5Backend } from 'react-dnd-html5-backend';
-import { DndProvider } from 'react-dnd';
import AdhocFilter, {
EXPRESSION_TYPES,
CLAUSES,
} from 'src/explore/components/controls/FilterControl/AdhocFilter';
import AdhocFilterOption, { AdhocFilterOptionProps } from '.';
+jest.mock('src/components/Icons/Icon', () => ({
+ __esModule: true,
+ default: ({
+ fileName,
+ role,
+ iconColor,
+ ...rest
+ }: {
+ fileName: string;
+ role: string;
+ iconColor: string;
+ }) => (
+ <span
+ role={role ?? 'img'}
+ aria-label={fileName.replace('_', '-')}
+ // @ts-ignore
Review Comment:
This is to prevent the following warning in the test:
```
Warning: React does not recognize the `iconColor` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `iconcolor` instead. If you accidentally passed it from a parent component, remove it from the DOM element.
in span (created by default)
...
```
This seemed arbitrary to the functionality so I felt it was safe to ignore.
--
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: notifications-unsubscribe@superset.apache.org
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] lyndsiWilliams merged pull request #22915: test: Clean up AdhocFilterOption test warnings
Posted by "lyndsiWilliams (via GitHub)" <gi...@apache.org>.
lyndsiWilliams merged PR #22915:
URL: https://github.com/apache/superset/pull/22915
--
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: notifications-unsubscribe@superset.apache.org
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] lyndsiWilliams commented on a diff in pull request #22915: test: Clean up AdhocFilterOption test warnings
Posted by "lyndsiWilliams (via GitHub)" <gi...@apache.org>.
lyndsiWilliams commented on code in PR #22915:
URL: https://github.com/apache/superset/pull/22915#discussion_r1093747306
##########
superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterOption/AdhocFilterOption.test.tsx:
##########
@@ -19,14 +19,35 @@
import React from 'react';
import { render, screen, waitFor } from 'spec/helpers/testing-library';
import userEvent from '@testing-library/user-event';
-import { HTML5Backend } from 'react-dnd-html5-backend';
-import { DndProvider } from 'react-dnd';
import AdhocFilter, {
EXPRESSION_TYPES,
CLAUSES,
} from 'src/explore/components/controls/FilterControl/AdhocFilter';
import AdhocFilterOption, { AdhocFilterOptionProps } from '.';
+jest.mock('src/components/Icons/Icon', () => ({
+ __esModule: true,
+ default: ({
+ fileName,
+ role,
+ iconColor,
+ ...rest
+ }: {
+ fileName: string;
+ role: string;
+ iconColor: string;
+ }) => (
+ <span
+ role={role ?? 'img'}
+ aria-label={fileName.replace('_', '-')}
+ // @ts-ignore
Review Comment:
That's much cleaner, thanks! Fixed in [`this commit`](https://github.com/apache/superset/pull/22915/commits/b4c2371b09bb63ef76021a02faa7d7b1f7968f39).
--
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: notifications-unsubscribe@superset.apache.org
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 #22915: test: Clean up AdhocFilterOption test warnings
Posted by codecov.
codecov[bot] commented on PR #22915:
URL: https://github.com/apache/superset/pull/22915#issuecomment-1409545366
# [Codecov](https://codecov.io/gh/apache/superset/pull/22915?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#22915](https://codecov.io/gh/apache/superset/pull/22915?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (f80125f) into [master](https://codecov.io/gh/apache/superset/commit/f2b61fca1537d0a80fafb5b313a365743cc41186?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (f2b61fc) will **decrease** coverage by `0.77%`.
> The diff coverage is `n/a`.
```diff
@@ Coverage Diff @@
## master #22915 +/- ##
==========================================
- Coverage 67.32% 66.55% -0.77%
==========================================
Files 1876 1876
Lines 72089 72089
Branches 7872 7872
==========================================
- Hits 48532 47977 -555
- Misses 21537 22092 +555
Partials 2020 2020
```
| Flag | Coverage Δ | |
|---|---|---|
| hive | `52.73% <ø> (ø)` | |
| mysql | `?` | |
| postgres | `?` | |
| presto | `52.62% <ø> (ø)` | |
| python | `80.37% <ø> (-1.61%)` | :arrow_down: |
| sqlite | `77.08% <ø> (ø)` | |
| unit | `51.67% <ø> (ø)` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/superset/pull/22915?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [superset/datasets/commands/create.py](https://codecov.io/gh/apache/superset/pull/22915?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YXNldHMvY29tbWFuZHMvY3JlYXRlLnB5) | `30.61% <0.00%> (-69.39%)` | :arrow_down: |
| [superset/datasets/commands/update.py](https://codecov.io/gh/apache/superset/pull/22915?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YXNldHMvY29tbWFuZHMvdXBkYXRlLnB5) | `25.00% <0.00%> (-69.05%)` | :arrow_down: |
| [superset/datasets/commands/bulk\_delete.py](https://codecov.io/gh/apache/superset/pull/22915?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YXNldHMvY29tbWFuZHMvYnVsa19kZWxldGUucHk=) | `33.33% <0.00%> (-53.34%)` | :arrow_down: |
| [superset/datasets/columns/commands/delete.py](https://codecov.io/gh/apache/superset/pull/22915?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YXNldHMvY29sdW1ucy9jb21tYW5kcy9kZWxldGUucHk=) | `44.11% <0.00%> (-52.95%)` | :arrow_down: |
| [superset/datasets/metrics/commands/delete.py](https://codecov.io/gh/apache/superset/pull/22915?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YXNldHMvbWV0cmljcy9jb21tYW5kcy9kZWxldGUucHk=) | `44.11% <0.00%> (-52.95%)` | :arrow_down: |
| [superset/datasets/dao.py](https://codecov.io/gh/apache/superset/pull/22915?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YXNldHMvZGFvLnB5) | `44.21% <0.00%> (-50.35%)` | :arrow_down: |
| [superset/sql\_validators/postgres.py](https://codecov.io/gh/apache/superset/pull/22915?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvc3FsX3ZhbGlkYXRvcnMvcG9zdGdyZXMucHk=) | `50.00% <0.00%> (-50.00%)` | :arrow_down: |
| [superset/datasets/commands/delete.py](https://codecov.io/gh/apache/superset/pull/22915?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YXNldHMvY29tbWFuZHMvZGVsZXRlLnB5) | `48.57% <0.00%> (-48.58%)` | :arrow_down: |
| [superset/datasets/commands/refresh.py](https://codecov.io/gh/apache/superset/pull/22915?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YXNldHMvY29tbWFuZHMvcmVmcmVzaC5weQ==) | `43.75% <0.00%> (-43.75%)` | :arrow_down: |
| [superset/datasets/commands/duplicate.py](https://codecov.io/gh/apache/superset/pull/22915?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGF0YXNldHMvY29tbWFuZHMvZHVwbGljYXRlLnB5) | `53.24% <0.00%> (-37.67%)` | :arrow_down: |
| ... and [30 more](https://codecov.io/gh/apache/superset/pull/22915?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
:mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
--
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: notifications-unsubscribe@superset.apache.org
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