How to use the enzyme-to-json.shallowToJson function in enzyme-to-json

To help you get started, we’ve selected a few enzyme-to-json examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ging / ediphy / _editor / components / autosave / __tests__ / AutoSave.spec.js View on Github external
it('should render with isRequired props', () => {
        const saving = shallow(
             {
                // eslint-disable-next-line no-console
                console.log("Saving...");
            }}/>);
        expect(shallowToJson(saving)).toMatchSnapshot();
    });
});
github timscott / react-devise / src / routing / AuthRoutes.spec.js View on Github external
it('should render with custom views', () => {
    initReactDevise({
      ...auth,
      routes: {
        login: {
          path: '/foo',
          component: MyLogin
        }
      }
    });
    const component = shallow();
    expect(component.find(Route)).toHaveLength(6);
    const tree = shallowToJson(component);
    expect(tree.children.some(n => n.props.path === '/users/foo')).toBeTruthy();

    // TODO: This does not test that custom view component is being used.
    // expect(component.find('div.my-login')).toHaveLength(1);
  });
});
github kovndr / braintree-dropin-react / src / index.spec.js View on Github external
it('should render', () => {
    const component = shallow( {}} submitButtonText='TEXT' />)
    const tree = shallowToJson(component)
    expect(tree).toMatchSnapshot()
  });

enzyme-to-json

convert enzyme wrapper to a format compatible with Jest snapshot

MIT
Latest version published 3 years ago

Package Health Score

74 / 100
Full package analysis