1import React from 'react'
2import { shallow } from 'enzyme'
3import { configure } from 'enzyme'
4import Adapter from 'enzyme-adapter-react-15'
5
6import SongLink from '../components/SongLink'
7
8configure({ adapter: new Adapter() })
9
10test('it renders correctly', () => {
11 const component = shallow(<SongLink />)
12 let tree = component.toJSON()
13 expect(tree).toMatchSnapshot()
14})
15
1import React from 'react'
2import { shallow } from 'enzyme'
3import { configure } from 'enzyme'
4import Adapter from 'enzyme-adapter-react-15'
5
6import SongLink from '../components/SongLink'
7
8configure({ adapter: new Adapter() })
9
10test('it renders correctly', () => {
11
12 // This is where I tried to imitate the props and pass them in.
13
14 const songLinkProps = {
15 result: {
16 id: '6rPO02ozF3bM7NnOV4h6s2'
17 },
18 handleClick: () => {
19 console.log('click')
20 }
21 }
22
23 const component = shallow(<SongLink key={songLinkProps.result.id} />)
24 let tree = component.toJSON()
25 expect(tree).toMatchSnapshot()
26})
27