0
我測試飾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())
})
})
組件被裝飾爲: