1
의 'xxx는' 정의되지 않는다.문제 속성을 읽을 수 없습니다 내가 다음 테스트 케이스를 사용하여 오류가 발생 정의되지 않은
간단한 아이디어로 해결하는 방법에 대한 아이디어는 매우 환영합니다.
구성 요소 :
import React, {Component} from 'react'
import IconWeather from '../../shared/icon/IconWeather'
class SummaryChartIcon extends Component {
render() {
const { cx, cy, payload: {weatherIconCode} } = this.props
return (
<svg x={cx - 10} y={cy + 20}>
<foreignObject width='100%' height='100%'>
<IconWeather code={weatherIconCode} />
</foreignObject>
</svg>
)
}
}
export default SummaryChartIcon
테스트 케이스 :
import React from 'react'
import {shallow} from 'enzyme'
import toJson from 'enzyme-to-json'
import SummaryChartIcon from './SummaryChartIcon'
describe('<SummaryChartIcon />',() => {
it('should render',() => {
const wrapper = shallow(
<SummaryChartIcon weatherIconCode={200} />
)
expect(toJson(wrapper)).toMatchSnapshot()
})
})