Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Testing Foo interaction using jest + enzyme + enzyme-to-json
'use strict';
const Foo = require('../Foo');
const React = require('react');
import { mount } from 'enzyme';
import { mountToJson } from 'enzyme-to-json';
describe('Foo', () => {
it('simulate a change event using enzyme', () => {
const wrapper = mount(<Foo />);
const input = wrapper.find('input');
input.node.value = 'this is a new value';
input.simulate('change', input);
expect(mountToJson(wrapper)).toMatchSnapshot()
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.