Created
October 26, 2016 13:19
-
-
Save kentaromiura/2563656795a44b9d8b560dc97e0add4e to your computer and use it in GitHub Desktop.
Testing Foo interaction using jest + enzyme + enzyme-to-json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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