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/02/26 10:19:18 UTC
[GitHub] [superset] geido opened a new pull request #13358: test: ErrorMessage components tests
geido opened a new pull request #13358:
URL: https://github.com/apache/superset/pull/13358
### SUMMARY
Adds the tests for the ErrorMessage components, including:
ErrorMessage/IssueCode.test.tsx
ErrorMessage/BasicErrorAlert.test.tsx
ErrorMessage/ErrorMessageWithStackTrace.test.tsx
ErrorMessage/ErrorAlert.test.tsx
ErrorMessage/TimeoutErrorMessage.test.tsx
In addition, it moves the ErrorMessage/getErrorMessageComponentRegistry.test.tsx to the ErrorMessage directory.
----------------------------------------------------------------
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 #13358: test: ErrorMessage components tests
Posted by GitBox <gi...@apache.org>.
rusackas merged pull request #13358:
URL: https://github.com/apache/superset/pull/13358
----------------------------------------------------------------
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 #13358: test: ErrorMessage components tests
Posted by GitBox <gi...@apache.org>.
rusackas commented on a change in pull request #13358:
URL: https://github.com/apache/superset/pull/13358#discussion_r585048294
##########
File path: superset-frontend/src/components/ErrorMessage/BasicErrorAlert.test.tsx
##########
@@ -0,0 +1,96 @@
+/**
+ * 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 React from 'react';
+import { render, screen } from 'spec/helpers/testing-library';
+import { supersetTheme } from '@superset-ui/core';
+import BasicErrorAlert from './BasicErrorAlert';
+import { ErrorLevel } from './types';
+
+const mockedProps = {
+ body: 'Error body',
+ level: 'warning' as ErrorLevel,
+ title: 'Error title',
+};
+
+jest.mock('../Icon', () => ({
+ __esModule: true,
+ default: ({ name }: { name: string }) => (
+ <div data-test="icon" data-name={name} />
+ ),
+}));
+
+test('should render', () => {
+ const { container } = render(<BasicErrorAlert {...mockedProps} />);
+ expect(container).toBeInTheDocument();
+});
+
+test('should render warning icon', () => {
+ render(<BasicErrorAlert {...mockedProps} />);
+ expect(screen.getByTestId('icon')).toBeInTheDocument();
+ expect(screen.getByTestId('icon')).toHaveAttribute(
+ 'data-name',
+ 'warning-solid',
+ );
+});
+
+test('should render error icon', () => {
+ const errorProps = {
+ ...mockedProps,
+ level: 'error' as ErrorLevel,
+ };
+ render(<BasicErrorAlert {...errorProps} />);
+ expect(screen.getByTestId('icon')).toBeInTheDocument();
+ expect(screen.getByTestId('icon')).toHaveAttribute(
+ 'data-name',
+ 'error-solid',
+ );
+});
+
+test('should render the error title', () => {
+ render(<BasicErrorAlert {...mockedProps} />);
+ expect(screen.getByText('Error title')).toBeInTheDocument();
+});
+
+test('should render the error body', () => {
+ render(<BasicErrorAlert {...mockedProps} />);
+ expect(screen.getByText('Error body')).toBeInTheDocument();
+});
+
+test('should render with warning theme', () => {
+ render(<BasicErrorAlert {...mockedProps} />);
+ expect(screen.getByRole('alert')).toHaveStyle(
+ `
+ backgroundColor: ${supersetTheme.colors.warning.light2};
Review comment:
Not sure this is even a nit as much as just something to point out. The `render` function is passing the `theme` in, so these sorts of tests seem to just test _that_. Which is fine, I suppose. But also maybe worth noting that we're asserting the supersetTheme color here by direct invocation. This is interesting (and potentially useful) in that the `<ThemeProvider>` in the App(s) can be (and likely _will_ be) used to mutate the theme (e.g. override it, invert it, etc). So when we get to testing all of that stuff, these tests will get more interesting :D
----------------------------------------------------------------
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 #13358: test: ErrorMessage components tests
Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on pull request #13358:
URL: https://github.com/apache/superset/pull/13358#issuecomment-788239161
# [Codecov](https://codecov.io/gh/apache/superset/pull/13358?src=pr&el=h1) Report
> Merging [#13358](https://codecov.io/gh/apache/superset/pull/13358?src=pr&el=desc) (4fc7c88) into [master](https://codecov.io/gh/apache/superset/commit/1e3130d58849a702088248872c65574040a534de?el=desc) (1e3130d) will **decrease** coverage by `3.69%`.
> The diff coverage is `82.78%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/13358/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l)](https://codecov.io/gh/apache/superset/pull/13358?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #13358 +/- ##
==========================================
- Coverage 77.04% 73.35% -3.70%
==========================================
Files 894 597 -297
Lines 45664 21261 -24403
Branches 5490 5420 -70
==========================================
- Hits 35184 15596 -19588
+ Misses 10356 5539 -4817
- Partials 124 126 +2
```
| Flag | Coverage Δ | |
|---|---|---|
| cypress | `57.65% <68.00%> (+0.02%)` | :arrow_up: |
| hive | `?` | |
| javascript | `63.19% <64.23%> (+0.78%)` | :arrow_up: |
| mysql | `?` | |
| 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/13358?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [...set-frontend/src/common/components/Modal/Modal.tsx](https://codecov.io/gh/apache/superset/pull/13358/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbW1vbi9jb21wb25lbnRzL01vZGFsL01vZGFsLnRzeA==) | `100.00% <ø> (ø)` | |
| [...nd/src/components/ErrorMessage/BasicErrorAlert.tsx](https://codecov.io/gh/apache/superset/pull/13358/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvRXJyb3JNZXNzYWdlL0Jhc2ljRXJyb3JBbGVydC50c3g=) | `100.00% <ø> (+64.70%)` | :arrow_up: |
| [...rontend/src/components/ErrorMessage/ErrorAlert.tsx](https://codecov.io/gh/apache/superset/pull/13358/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvRXJyb3JNZXNzYWdlL0Vycm9yQWxlcnQudHN4) | `91.83% <ø> (+71.42%)` | :arrow_up: |
| [superset-frontend/src/constants.ts](https://codecov.io/gh/apache/superset/pull/13358/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbnN0YW50cy50cw==) | `100.00% <ø> (ø)` | |
| [superset-frontend/src/dashboard/index.jsx](https://codecov.io/gh/apache/superset/pull/13358/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9pbmRleC5qc3g=) | `63.63% <0.00%> (-6.37%)` | :arrow_down: |
| [...nd/src/explore/components/ExploreViewContainer.jsx](https://codecov.io/gh/apache/superset/pull/13358/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9FeHBsb3JlVmlld0NvbnRhaW5lci5qc3g=) | `78.04% <ø> (-0.14%)` | :arrow_down: |
| [.../explore/components/controls/CollectionControl.jsx](https://codecov.io/gh/apache/superset/pull/13358/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9Db2xsZWN0aW9uQ29udHJvbC5qc3g=) | `45.45% <ø> (+3.78%)` | :arrow_up: |
| [.../controls/MetricControl/AdhocMetricEditPopover.jsx](https://codecov.io/gh/apache/superset/pull/13358/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9NZXRyaWNDb250cm9sL0FkaG9jTWV0cmljRWRpdFBvcG92ZXIuanN4) | `79.54% <ø> (+0.44%)` | :arrow_up: |
| [...nents/controls/MetricControl/AdhocMetricOption.jsx](https://codecov.io/gh/apache/superset/pull/13358/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9NZXRyaWNDb250cm9sL0FkaG9jTWV0cmljT3B0aW9uLmpzeA==) | `100.00% <ø> (ø)` | |
| [...ntrols/MetricControl/AdhocMetricPopoverTrigger.tsx](https://codecov.io/gh/apache/superset/pull/13358/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9NZXRyaWNDb250cm9sL0FkaG9jTWV0cmljUG9wb3ZlclRyaWdnZXIudHN4) | `94.73% <ø> (ø)` | |
| ... and [331 more](https://codecov.io/gh/apache/superset/pull/13358/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/13358?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/13358?src=pr&el=footer). Last update [1e3130d...fd705b1](https://codecov.io/gh/apache/superset/pull/13358?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