Skip to content

Commit

Permalink
Change CodeEditor test to use a snapshot test
Browse files Browse the repository at this point in the history
We only care that the component renders without an error and doesn't
change unintentionally, which makes this a perfect use case for snapshot
testing.
  • Loading branch information
noisysocks committed Jan 10, 2018
1 parent b5e46f1 commit e2c619d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions components/code-editor/test/__snapshots__/index.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`CodeEditor should render without an error 1`] = `
<textarea
value="<b>wowee</b>"
/>
`;
2 changes: 1 addition & 1 deletion components/code-editor/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ describe( 'CodeEditor', () => {
} ) );

const wrapper = shallow( <CodeEditor value={ '<b>wowee</b>' } /> );
expect( wrapper.find( 'textarea' ) ).toHaveLength( 1 );
expect( wrapper ).toMatchSnapshot();
} );
} );

0 comments on commit e2c619d

Please sign in to comment.