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

TypeError: Cannot read properties of undefined (reading 'Provider') - Jest #134

Open
cyberkaidev opened this issue May 22, 2023 · 4 comments

Comments

@cyberkaidev
Copy link

I'm trying to do a test, but it's giving this error and I don't know how to solve it.
My test:

test('Render component without load', () => {
  const { getByTestId } = render(<Chart data={configTest.data} isLoading={false} />);
  
  expect(getByTestId(configTest.id)).toBeTruthy();
});

Result:

TypeError: Cannot read properties of undefined (reading 'Provider')

   12 |                      {!isLoading && (
> 13 |                              <LineChart.Provider data={data}>
        |                                         ^
   14 |                                      <LineChart height={250}>
   15 |                                              <LineChart.Path color={themes.colors.purple_100}>
   16 |                                                      <LineChart.Gradient />
@julian-dotcom
Copy link

Having a similar issue

@AlmirNeeto99
Copy link

Anything on this? I'm having a similar issue.

@cyberkaidev
Copy link
Author

Anything on this? I'm having a similar issue.

No, I migrated to another lib

@antonandreyev
Copy link

I experienced the same error and appeared that we had module with this context mocked in some other test file like

jest.mock("@client/contexts/SelectedContractContext.tsx");

Removing the mock solved the issue

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

No branches or pull requests

4 participants