Skip to content

How to use Unistore action in JEST for shallow testing? #181

Open

Description

@MdAyman7

I am facing an error while testing my react app from JEST. It shows an error as "TypeError: Cannot read property 'action' of undefined".
Can I know how do I solve this error?

Activity

  1. changed the title [-]How to test using Jest with Unistore?[/-] [+]How to use Unistore action in JEST for shallow testing?[/+] on Nov 27, 2019
  2. ashnehete commented on Jan 30, 2020

    @ashnehete

    I was facing the same error message. To solve it, I wrapped the Component around Provider.
    mount(<Provider store={store}><Component /></Provider>)

  3. zgoda commented on Mar 17, 2021

    @zgoda

    Unfortunately shallow(<Provider store={store}><ConnectionBox /></Provider>).debug() produces <i /> and I am not sure what I can do with it.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions