Skip to content

Instantly share code, notes, and snippets.

@vvo

vvo/test.js

Created Oct 20, 2015
Embed
What would you like to do?
expect-jsx test
import React from 'react';
import expect from 'expect';
import {createRenderer} from 'react-addons-test-utils';
import expectJSX from 'expect-jsx';
expect.extend(expectJSX);
import Button from './Button.js';
import Label from './Label.js';
describe('Button', () => {
it('works', () => {
let renderer = createRenderer();
renderer.render(<Button name="John" />);
let actualElement = renderer.getRenderOutput();
let expectedElement = <div><Label name="John" /></div>;
expect(actualElement).toEqualJSX(expectedElement);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment