How to use the enzyme-to-json.mountToJson 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 conveyal / analysis-ui / lib / components / __tests__ / collapsible.js View on Github external
it('collapses correctly', () => {
    const tree = mount(
      
        <div>Lorem ipsum dolor sit amet.</div>
      
    )

    tree.find('div &gt; .CollapsibleButton').simulate('click')

    expect(mountToJson(tree)).toMatchSnapshot()
  })
})
github conveyal / analysis-ui / lib / components / __tests__ / directional-markers.js View on Github external
it('renders correctly', () =&gt; {
    const wrapper = mount(
      <map>
        
      </map>
    )
    expect(mountToJson(wrapper)).toMatchSnapshot()
  })
github kkemple / universal-components-example / packages / universal-components / components / button / __tests__ / index.js View on Github external
it('<button>', () =&gt; {
    const wrapper = mount(</button><button> {}} /&gt;);
    expect(mountToJson(wrapper)).toMatchSnapshot();
  });
</button>
github conveyal / analysis-ui / lib / components / analysis / __tests__ / legend.js View on Github external
it('should display', () =&gt; {
    const tree = mount(
      <legend min="{0}">
    )

    expect(mountToJson(tree)).toMatchSnapshot()
  })
})</legend>
github telus / tds-core / src / old-components / Headline / __tests__ / Headline.spec.jsx View on Github external
it('matches snapshot', () =&gt; {
    const wrapper = mount()
    expect(mountToJson(wrapper)).toMatchSnapshot()
  })
github conveyal / analysis-ui / lib / components / __tests__ / import-modifications.js View on Github external
it('renders correctly', () =&gt; {
    const copyFromProjectFn = jest.fn()
    const tree = mount(
      
    )
    expect(mountToJson(tree)).toMatchSnapshot()
    expect(copyFromProjectFn).not.toBeCalled()

    tree.find('.Select-control').simulate('keyDown', {keyCode: 40})
    tree.find('.Select-control').simulate('keyDown', {keyCode: 13})
    tree.find('.btn').simulate('click')

    expect(copyFromProjectFn).toBeCalled()
  })
})
github AlmeroSteyn / react-aria-live / src / modules / __tests__ / Announcer.spec.js View on Github external
it('should render correctly via snapshot', () =&gt; {
    const wrapper = mount();

    const tree = mountToJson(wrapper);
    expect(tree).toMatchSnapshot();
  });
github conveyal / analysis-ui / lib / __tests__ / routes.js View on Github external
it('should render', function () {
    const store = makeMockStore(mockStores.init)
    const component = mount(
      
        
      
    )
    expect(mountToJson(component)).toMatchSnapshot()
  })
})
github timscott / react-devise / src / views / AuthLinks.spec.js View on Github external
initReactDevise({
      routes: {
        login: {
          path: '/foo',
          linkText: 'Foo Bar'
        }
      }
    });
    const component = mount();
    const tree = mountToJson(component);
    const list = tree.children[0].children[0];
    expect(list.children.some(listItem =&gt; {
      return (
        listItem.children[0].children[0].props.href === '/users/foo' &amp;&amp;
        listItem.children[0].children[0].children[0] === 'Foo Bar'
      );
    })).toBeTruthy();
  });
});

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