Skip to content

Commit

Permalink
Convert snapshots to use react-test-renderer/shallow (core-blocks/mor…
Browse files Browse the repository at this point in the history
…e/test/edit.js) (#7756)

* convert snapshots to use react-test-renderer/shallow

Note: with react-test-renderer, the current version of the jest pretty-format module does not handle pretty names for `React.Fragment` and `React.forwardRef`.  Thus the snapshot results in `<Undefined>`.

* no need for a constant definition here
  • Loading branch information
nerrad authored and gziolo committed Jul 13, 2018
1 parent e4ac2f4 commit 843ba97
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions core-blocks/more/test/edit.js
@@ -1,7 +1,8 @@
/**
* External dependencies
*/
import { shallow } from 'enzyme';
import Shallow from 'react-test-renderer/shallow';
const ShallowRenderer = new Shallow();
/**
* Internal dependencies
*/
Expand All @@ -17,12 +18,12 @@ describe( 'core/more/edit', () => {
attributes.noTeaser = false;
} );
test( 'should match snapshot when noTeaser is false', () => {
const wrapper = shallow( <MoreEdit attributes={ attributes } /> );
expect( wrapper ).toMatchSnapshot();
ShallowRenderer.render( <MoreEdit attributes={ attributes } /> );
expect( ShallowRenderer.getRenderOutput() ).toMatchSnapshot();
} );
test( 'should match snapshot when noTeaser is true', () => {
attributes.noTeaser = true;
const wrapper = shallow( <MoreEdit attributes={ attributes } /> );
expect( wrapper ).toMatchSnapshot();
ShallowRenderer.render( <MoreEdit attributes={ attributes } /> );
expect( ShallowRenderer.getRenderOutput() ).toMatchSnapshot();
} );
} );

0 comments on commit 843ba97

Please sign in to comment.