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

[BUG] Can't mock overmind for jest snapshots #594

Open
crimson-med opened this issue Jul 18, 2023 · 1 comment
Open

[BUG] Can't mock overmind for jest snapshots #594

crimson-med opened this issue Jul 18, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@crimson-med
Copy link
Contributor

We are currently using overmind on a project and have added Jest snapshots for testing the coverage and the components.

import { render } from '@testing-library/react'
import Home from './page'

it(`renders correctly`, () => {
  const { container } = render(<Home />)
  expect(container).toMatchSnapshot()
})

Withing the home page a few sub components are rendered which use the useAppState function and this creates some issues within the test:

The Overmind hook could not find an Overmind instance on the context of React. Please make sure you use the Provider component at the top of your application and expose the Overmind instance there. Please read more in the React guide on the website

const { myState } = useAppState().api

How to make overmind compatible with the following types of tests.

@crimson-med crimson-med added the bug Something isn't working label Jul 18, 2023
@dpraimeyuu
Copy link
Contributor

@crimson-med did you wrap your container in Overmind provider?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants