React Navigation无法在Jest Snapshot Testing中呈现多HOC组件

时间:2018-03-12 13:01:46

标签: react-native react-redux jestjs react-navigation

简单地说,我有一个由三个高阶组件组成的组件。两个是定制的,第三个是来自redux的连接HOC。组件的导出定义如下所示:

{ [Function: Connect] WrappedComponent: { [Function: WithDrawerComponent] navigationOptions: [Function], defaultProps: { drawerOptions: [Object] }, propTypes: { drawerOptions: [Object], navigation: [Object] } }, displayName: 'Connect(WithDrawerComponent)', childContextTypes: { storeSubscription: { [Function: bound checkType] isRequired: [Function: bound checkType] } }, contextTypes: { store: { [Function: bound checkType] isRequired: [Function: bound checkType] }, storeSubscription: { [Function: bound checkType] isRequired: [Function: bound checkType] } }, propTypes: { store: { [Function: bound checkType] isRequired: [Function: bound checkType] }, storeSubscription: { [Function: bound checkType] isRequired: [Function: bound checkType] } }, navigationOptions: [Function] }

运行应用程序时不会抛出任何错误。实际上,它在开发和生产中正确运行。但是,在我的jest测试套件中,我收到以下错误:

{{1}}

在console.logging从'Splash'返回后,我得到:

{{1}}

非常感谢任何帮助!

0 个答案:

没有答案