Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Test] Fix console warning in field_editor.test.tsx #674

Merged
merged 1 commit into from
Jul 28, 2021

Conversation

ananzh
Copy link
Member

@ananzh ananzh commented Jul 27, 2021

Description

Currently, unit test field_editor.test.tsx shows a console warning:

React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. 

This warning is because EuiCodeEditor is missing in the mock of elastic/eui, which causes undefined EuiCodeEditor in the test.

PR Resolved:

#673

Test results

unit test for field_editor.test.tsx

yarn test:jest src/plugins/index_pattern_management/public/components/field_editor/field_editor.test.tsx -u
yarn run v1.22.5
$ node scripts/jest src/plugins/index_pattern_management/public/components/field_editor/field_editor.test.tsx -u
 PASS  src/plugins/index_pattern_management/public/components/field_editor/field_editor.test.tsx
  FieldEditor
    ✓ should render create new scripted field correctly (15 ms)
    ✓ should render edit scripted field correctly (5 ms)
    ✓ should show deprecated lang warning (4 ms)
    ✓ should show conflict field warning (4 ms)
    ✓ should show multiple type field warning with a table containing indices (4 ms)

 › 5 snapshots updated.
Snapshot Summary
 › 5 snapshots updated from 1 test suite.

Test Suites: 1 passed, 1 total
Tests:       5 passed, 5 total
Snapshots:   5 updated, 5 total
Time:        3.688 s, estimated 4 s

Overall test result:

Screen Shot 2021-07-27 at 1 42 42 PM

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

Currently, unit test field_editor.test.tsx shows a console warning:

```React.createElement: type is invalid -- expected a string
(for built-in components) or a class/function (for composite components)
but got: undefined. ```

This warning is because EuiCodeEditor is missing in the mock of elastic/eui,
which causes undefined EuiCodeEditor in the test.

PR Resolved:
opensearch-project#673

Signed-off-by: Anan Zhuang <ananzh@amazon.com>
@opensearch-ci-bot
Copy link
Collaborator

✅   DCO Check Passed 027410f

Copy link
Contributor

@tmarkley tmarkley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ananzh ananzh merged commit 5b5ac4e into opensearch-project:main Jul 28, 2021
ananzh added a commit to ananzh/OpenSearch-Dashboards that referenced this pull request Jul 29, 2021
Currently, unit test field_editor.test.tsx shows a console warning:

```React.createElement: type is invalid -- expected a string
(for built-in components) or a class/function (for composite components)
but got: undefined. ```

This warning is because EuiCodeEditor is missing in the mock of elastic/eui,
which causes undefined EuiCodeEditor in the test.

PR Resolved:
opensearch-project#673

Backport PR:
opensearch-project#674

Signed-off-by: Anan Zhuang <ananzh@amazon.com>
ananzh added a commit that referenced this pull request Jul 29, 2021
Currently, unit test field_editor.test.tsx shows a console warning:

```React.createElement: type is invalid -- expected a string
(for built-in components) or a class/function (for composite components)
but got: undefined. ```

This warning is because EuiCodeEditor is missing in the mock of elastic/eui,
which causes undefined EuiCodeEditor in the test.

PR Resolved:
#673

Backport PR:
#674

Signed-off-by: Anan Zhuang <ananzh@amazon.com>
@tmarkley
Copy link
Contributor

tmarkley commented Aug 3, 2021

@ananzh I just noticed that you updated snapshots but didn't include the new snapshots in the PR. I'll fix that.

@tmarkley tmarkley mentioned this pull request Aug 3, 2021
1 task
tmarkley pushed a commit to tmarkley/OpenSearch-Dashboards that referenced this pull request Aug 3, 2021
Previous PR opensearch-project#674 did not include updated snapshots.

Related to opensearch-project#673

Signed-off-by: Tommy Markley <markleyt@amazon.com>
@tmarkley tmarkley mentioned this pull request Aug 3, 2021
5 tasks
tmarkley pushed a commit that referenced this pull request Aug 4, 2021
Previous PR #674 did not include updated snapshots.

Related to #673

Signed-off-by: Tommy Markley <markleyt@amazon.com>
tmarkley pushed a commit to tmarkley/OpenSearch-Dashboards that referenced this pull request Aug 5, 2021
Previous PR opensearch-project#674 did not include updated snapshots.

Related to opensearch-project#673

Signed-off-by: Tommy Markley <markleyt@amazon.com>
tmarkley pushed a commit that referenced this pull request Aug 6, 2021
Previous PR #674 did not include updated snapshots.

Related to #673

Signed-off-by: Tommy Markley <markleyt@amazon.com>
@ananzh ananzh deleted the invalid_type branch February 23, 2022 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants