2017-10-21 10 views
0
I 효소와 농담으로 JSCC으로 장식 된 구성 요소를 테스트입니다

의 특성 'contextTypes'를 읽을 수 있지만 나는 다음과 같은 오류 수신 할 수 없음 :효소 장식 요소의 형식 오류 : 정의되지 않은

TypeError: Cannot read property 'contextTypes' of undefined

방법이 스타일의 구성 요소를 테스트 할 수 있습니까?

import React from 'react' 
 
import { shallow } from 'enzyme' 
 
import { PdfViewer } from './PdfViewer' 
 

 
const baseProps = { 
 
    location: 'url', 
 
    defaultPage: 1, 
 
    classes: {}, 
 
    handlePageChanged:() => {}, 
 
} 
 

 
describe('<PdfViewer />',() => { 
 
    it('should work',() => { 
 
    const wrapper = shallow(<PdfViewer {...baseProps} />) 
 
    console.log(wrapper.debug()) 
 
    }) 
 
})
성분은 장식 등 :

class PdfViewer extends React.Component{} 
 
../ 
 
export default withStyles(styleSheet)(PdfViewer)

답변

0
import { muiTheme } from 'material-ui/styles' 
 
const wrapper = shallow(<PdfViewer {...baseProps} />, { context: { muiTheme } })