React native react本机组件测试未知属性错误

React native react本机组件测试未知属性错误,react-native,jestjs,enzyme,React Native,Jestjs,Enzyme,我有一个react原生容器组件,我正试图用jest,enzyme测试它。在下面的测试中,我只是简单地测试登录是否通过道具调用动作方法。在我运行测试时,我得到了一系列未知的属性错误,包括我的登录按钮的onpress属性: console.error node_modules\react-native\Libraries\Core\ExceptionsManager.js:71 Warning: Failed prop type: Required prop `onPress` was not s

我有一个react原生容器组件,我正试图用jest,enzyme测试它。在下面的测试中,我只是简单地测试登录是否通过道具调用动作方法。在我运行测试时,我得到了一系列未知的属性错误,包括我的登录按钮的onpress属性:

console.error node_modules\react-native\Libraries\Core\ExceptionsManager.js:71

Warning: Failed prop type: Required prop `onPress` was not specified in `But
ton`.
    in Button

 console.error node_modules\react-native\Libraries\Core\ExceptionsManager.js:71

Warning: Unknown prop `source` on <Image> tag. Remove this prop from the ele
ment. For details
    in Image (created by Image)
    in Image (created by Login)
    in View (created by View)
    in View (created by Login)
    in Login (created by Constructor)
    in Constructor

console.error node_modules\react-native\Libraries\Core\ExceptionsManager.js:71

Warning: Unknown prop `onChangeText` on <TextInput> tag. Remove this prop fr
om the element. For details,
    in TextInput (created by TextInput)
    in TextInput (created by Login)
    in View (created by View)
    in View (created by Login)
    in View (created by View)
    in View (created by Login)
    in Login (created by Constructor)
    in Constructor

 console.error node_modules\react-native\Libraries\Core\ExceptionsManager.js:71

   Warning: Unknown props `onPress`, `accessible`, `allowFontScaling`, `ellipsi
zeMode` on <Text> tag. Remove these props from the element. For details, see htt

    in Text (created by Text)
    in Text (created by Login)
    in View (created by View)
    in View (created by Login)
    in View (created by View)
    in View (created by Login)
    in Login (created by Constructor)
    in Constructor

console.error node_modules\react-native\Libraries\Core\ExceptionsManager.js:71

Warning: Unknown props `accessibilityComponentType`, `accessibilityLabel`, `
accessibilityTraits`, `activeOpacity` on <TouchableOpacity> tag. Remove these pr
ops from the element. For details, see
    in TouchableOpacity (created by TouchableOpacity)
    in TouchableOpacity (created by Button)
    in Button (created by Login)
    in View (created by View)
    in View (created by Login)
    in View (created by View)
    in View (created by Login)
    in Login (created by Constructor)
    in Constructor
console.error节点\u modules\react native\Libraries\Core\exceptionmanager.js:71
警告:失败的道具类型:所需道具'onPress'未在'But'中指定
吨。
在按钮
console.error节点\u modules\react native\Libraries\Core\exceptionmanager.js:71
警告:标签上的未知属性'source'。从ele上拆下此道具
是的。详情
在图像中(由图像创建)
在图像中(通过登录创建)
视图中(由视图创建)
视图中(通过登录创建)
登录中(由构造函数创建)
在构造函数中
console.error节点\u modules\react native\Libraries\Core\exceptionmanager.js:71
警告:标签上的未知属性'onChangeText'。取下这个道具
从元素开始。详情如下:,
in-TextInput(由TextInput创建)
in-TextInput(通过登录创建)
视图中(由视图创建)
视图中(通过登录创建)
视图中(由视图创建)
视图中(通过登录创建)
登录中(由构造函数创建)
在构造函数中
console.error节点\u modules\react native\Libraries\Core\exceptionmanager.js:71
警告:未知道具'onPress'、'accessible'、'allowFontScaling'、'ellipsi
标签上的zeMode。从元件上取下这些支柱。有关详细信息,请参见htt
在文本中(由文本创建)
在文本中(通过登录创建)
视图中(由视图创建)
视图中(通过登录创建)
视图中(由视图创建)
视图中(通过登录创建)
登录中(由构造函数创建)
在构造函数中
console.error节点\u modules\react native\Libraries\Core\exceptionmanager.js:71
警告:未知道具`accessibilityComponentType`、`accessibilityLabel``
标记上的accessibilityTraits`、`activeOpacity`。删除这些pr
来自元素的操作。有关详细信息,请参阅
在TouchableOpacity中(由TouchableOpacity创建)
在TouchableOpacity中(由按钮创建)
in按钮(通过登录创建)
视图中(由视图创建)
视图中(通过登录创建)
视图中(由视图创建)
视图中(通过登录创建)
登录中(由构造函数创建)
在构造函数中
我的测试

import LoginDefault,{Login}  from '../../app/routes/Login/LoginContainer';

test("checking if login function is bind to login button on click", () =>{
let actions = {
   login : jest.fn(),
 };

const wrapper = mount(
     <Login LoginActions={actions} loginState={{}} />
  );

let loginButton = wrapper.find('Button').first();
        console.log(loginButton.debug());
loginButton.simulate('click');

expect(actions.login.mock.calls.length).toBe(1);
});
import-LoginDefault,{Login}来自“../../app/routes/Login/Login-container”;
测试(“检查登录功能是否绑定到单击时的登录按钮”,()=>{
让动作={
登录名:jest.fn(),
};
常量包装器=装入(
);
让loginButton=wrapper.find('Button').first();
log(loginButton.debug());
loginButton.simulate('click');
expect(actions.login.mock.calls.length).toBe(1);
});
这些错误发生在调用mount()函数之后