Last active
January 18, 2018 04:09
-
-
Save Sparragus/a141ed70e664d13df7289ea135d87926 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Icon.test.js | |
import React from 'react' | |
import { shallow } from 'enzyme' | |
import Icon from './Icon' | |
describe('Icon', () => { | |
let tree, props | |
const buildTree = (newProps = {}) => { | |
const defaultProps = { | |
name: 'add', | |
} | |
props = Object.assign({}, defaultProps, newProps) | |
return shallow(<Icon {...props} />) | |
} | |
it('matches the snapshot', () => { | |
tree = buildTree() | |
expect( | |
tree | |
).toMatchSnapshot() | |
}) | |
it('adds the proper className given an icon name', () => { | |
tree = buildTree({ name: 'delete' }) | |
expect( | |
tree.hasClass('icon-delete') | |
).toBe( | |
true | |
) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment