Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save alanbsmith/6fa2c174fb7d3145ef926dacb3b5a6c2 to your computer and use it in GitHub Desktop.

Select an option

Save alanbsmith/6fa2c174fb7d3145ef926dacb3b5a6c2 to your computer and use it in GitHub Desktop.
effective-testing-for-styled-components-icon-test
// lib/elements/Icon/__tests__/index.js
import React from 'react';
import Icon from '../index';
import 'jest-styled-components';
import renderer from 'react-test-renderer';
describe('Icon Element', () => {
it('renders correctly', () => {
const tree = renderer.create(
<Icon name="home" />
).toJSON();
expect(tree).toMatchSnapshot();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment