Skip to content

Error: ShallowWrapper::state() can only be called on the root #814

@joetidee

Description

@joetidee

I am getting this error:

Error: ShallowWrapper::state() can only be called on the root

Here is my test:

it('default "errors" state is an empty object', () => {
    const router = {'react-router': {}};
    const wrapper = shallow(<IntlProvider><SignUpForm router={router} /></IntlProvider>);
    expect(wrapper.find(SignUpForm).state('errors')).to.equal({});
});

Would anyone be able to tell me how I can access/test the state of the SignUpForm component?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions