Skip to content

Instantly share code, notes, and snippets.

@carlosble
Created April 5, 2017 19:18
Show Gist options
  • Save carlosble/abed63b095e580bfa6afc91461815222 to your computer and use it in GitHub Desktop.
Save carlosble/abed63b095e580bfa6afc91461815222 to your computer and use it in GitHub Desktop.
Testing components in isolation with Enzyme's shallow
beforeEach(()=> {
form = shallow(<AddressForm
address={{}}
actions={actions}
/>);
});
it('contains exactly one email input for every address email', () => {
let address = addressBuilder().withEmails([email0, email1]).build();
form.setProps({address: address});
const inputs = emailInputs();
expect(inputs.at(0).props().value).toBe(email0);
expect(inputs.at(1).props().value).toBe(email1);
expect(inputs.length).toBe(2);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment