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

[1.x][Test] Wrap FunComponent in unit test with IntlProvider #661

Merged
merged 1 commit into from
Jul 23, 2021

Conversation

ananzh
Copy link
Member

@ananzh ananzh commented Jul 23, 2021

Description

In the FunctionComponent unit tests, we see many console errors:
Could not find required intl object. <IntlProvider> needs to exist in the component ancestry. 

This is because for some unit tests, we mount the FunctionComponent
(with Enzyme's mount()) , which access to the react-intl context by
FormattedMessage without their  parent wrapper.

This PR solves 7 out of 8 unit tests with this issue by wrapping the
either through original enzyme_helper functions or
a simple wrapper wrapWithIntl.

Partically Resolved:

#593

Backport PR:

#654

Signed-off-by: Anan Zhuang ananzh@amazon.com

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

In the FunctionComponent unit tests, we see many console errors:
`Could not find required intl object. <IntlProvider> needs to
exist in the component ancestry. `

This is because for some unit tests, we mount the FunctionComponent
(with Enzyme's mount()) , which access to the react-intl context by
FormattedMessage without their <IntlProvider /> parent wrapper.

This PR solves 7 out of 8 unit tests with this issue by wrapping the
<IntlProvider /> either through original enzyme_helper functions or
a simple wrapper wrapWithIntl.

Partically Resolved:
opensearch-project#593

Backport PR:
opensearch-project#654

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

✅   DCO Check Passed 5857a22

@ananzh ananzh merged commit cff01f8 into opensearch-project:1.x Jul 23, 2021
@ananzh ananzh deleted the 1.x_intlerror branch February 23, 2022 17:10
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.

2 participants