Skip to content

Instantly share code, notes, and snippets.

@ricca509
Created February 20, 2017 22:57
Show Gist options
  • Save ricca509/8504e0c2fa01d912817c20a0d3e6ed87 to your computer and use it in GitHub Desktop.
Save ricca509/8504e0c2fa01d912817c20a0d3e6ed87 to your computer and use it in GitHub Desktop.
snapshot-component-test-2
// BuyNow.test.jsx
import { shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import BuyNow from '../BuyNow';
describe('The BuyNow component', () => {
it('renders the right price and button', () => {
const props = { price: 25, text: 'Buy now' };
const tree = shallow(<BuyNow {...props} />);
expect(toJson(tree)).toMatchSnapshot();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment