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] Investigate console error in telemetry_management_section.test.tsx #555

Closed
ananzh opened this issue Jun 25, 2021 · 1 comment
Closed

Comments

@ananzh
Copy link
Member

ananzh commented Jun 25, 2021

Describe the issue

Currently, telemetry_management_section.test.tsx prints out console errors when run the unit test. To make a clean unit test, we want to explore the reasons for these errors/warnings and decide whether we could fix or remove them.

  console.error
    [React Intl] Could not find required `intl` object. <IntlProvider> needs to exist in the component ancestry. Using default message as fallback.

      at defaultFormatMessage (node_modules/react-intl/lib/index.js:1533:13)
      at FormattedMessage.render (node_modules/react-intl/lib/index.js:1638:30)
      at finishClassComponent (node_modules/react-dom/cjs/react-dom.development.js:18470:31)
      at updateClassComponent (node_modules/react-dom/cjs/react-dom.development.js:18423:24)
      at beginWork$1 (node_modules/react-dom/cjs/react-dom.development.js:20186:16)
      at beginWork$$1 (node_modules/react-dom/cjs/react-dom.development.js:25756:14)
      at performUnitOfWork (node_modules/react-dom/cjs/react-dom.development.js:24698:12)
      at workLoopSync (node_modules/react-dom/cjs/react-dom.development.js:24671:22)
      at performSyncWorkOnRoot (node_modules/react-dom/cjs/react-dom.development.js:24270:11)
      at scheduleUpdateOnFiber (node_modules/react-dom/cjs/react-dom.development.js:23698:7)
      at updateContainer (node_modules/react-dom/cjs/react-dom.development.js:27103:3)
      at node_modules/react-dom/cjs/react-dom.development.js:27528:7
      at unbatchedUpdates (node_modules/react-dom/cjs/react-dom.development.js:24433:12)

  console.error
    Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.
        in OptInExampleFlyout (created by TelemetryManagementSection)
        in TelemetryManagementSection (created by WrapperComponent)
        in WrapperComponent

      75 |       const { fetchExample } = this.props;
      76 |       const clusters = await fetchExample();
    > 77 |       this.setState({
         |            ^
      78 |         data: Array.isArray(clusters) ? clusters : null,
      79 |         isLoading: false,
      80 |         hasPrivilegeToRead: true,

      at warningWithoutStack (node_modules/react-dom/cjs/react-dom.development.js:530:32)
      at warnAboutUpdateOnUnmountedFiberInDEV (node_modules/react-dom/cjs/react-dom.development.js:25738:5)
      at scheduleUpdateOnFiber (node_modules/react-dom/cjs/react-dom.development.js:23679:5)
      at Object.enqueueSetState (node_modules/react-dom/cjs/react-dom.development.js:13994:5)
      at OptInExampleFlyout.setState (node_modules/react/cjs/react.development.js:325:16)
      at OptInExampleFlyout.componentDidMount (src/plugins/telemetry_management_section/public/components/opt_in_example_flyout.tsx:77:12)

To Reproduce
Run:yarn test:jest {path to telemetry_management_section.test.tsx}

Expected behavior

explore each problem unit test cases and investigate each question:

  • what causes the console error or issues?

  • should this unit test log this error or warning message?

  • if answer to the above question is no, then can we fix it?

The final output is expected to be a cleaned unit test with un-necessary error/warnings been removed.

OpenSearch Version
OpenSearch 1.0.0

Dashboards Version
Dashboards 1.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant