📌  相关文章
📜  如何在反应酶中传递属性组件 - Javascript代码示例

📅  最后修改于: 2022-03-11 15:04:09.103000             🧑  作者: Mango

代码示例1
import React from 'react'
import { shallow } from 'enzyme'
import { configure } from 'enzyme'
import Adapter from 'enzyme-adapter-react-15'

import SongLink from '../components/SongLink'

configure({ adapter: new Adapter() })   

test('it renders correctly', () => {

  // This is where I tried to imitate the props and pass them in. 

  const songLinkProps = {
    result: {
      id: '6rPO02ozF3bM7NnOV4h6s2'
    },
    handleClick: () => {
      console.log('click')
    }
  }

  const component = shallow()
  let tree = component.toJSON()
  expect(tree).toMatchSnapshot()
})