This commit is contained in:
Jonathan Belcher 2018-11-12 16:49:32 -05:00 committed by GitHub
parent 5033a1ba5c
commit cd00227875
2 changed files with 26 additions and 1 deletions

View File

@ -0,0 +1,20 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Card it renders correctly 1`] = `
<div
className="woocommerce-card"
>
<div
className="woocommerce-card__header"
>
<h2
className="woocommerce-card__title woocommerce-card__header-item"
>
A Card Example
</h2>
</div>
<div
className="woocommerce-card__body"
/>
</div>
`;

View File

@ -3,7 +3,7 @@
* *
* @format * @format
*/ */
import renderer from 'react-test-renderer';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
/** /**
@ -12,6 +12,11 @@ import { shallow } from 'enzyme';
import Card from '../'; import Card from '../';
describe( 'Card', () => { describe( 'Card', () => {
test( 'it renders correctly', () => {
const tree = renderer.create( <Card title="A Card Example" /> ).toJSON();
expect( tree ).toMatchSnapshot();
} );
test( 'should have correct title', () => { test( 'should have correct title', () => {
const card = <Card title="A Card Example" />; const card = <Card title="A Card Example" />;
expect( card.props.title ).toBe( 'A Card Example' ); expect( card.props.title ).toBe( 'A Card Example' );