1import React from 'react'
2import { shallow } from 'enzyme'
3import App from './App'
4import Modal from './Modal'
5
6test('renders learn react link', () => {
7 const property = {
8 comps: 'john doe'
9 }
10 const wrapper = shallow(<App {...property} />)
11 const getContent = wrapper.find(Modal).prop('comps')
12 expect(getContent).toBe('john doex')
13})
14
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
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