我正在使用笑话和酶为 React Native 应用程序编写单元测试。当我尝试运行测试用例时,出现以下错误:
\n\n\n\n\n\xe2\x97\x8f 测试套件运行失败
\n\n类型错误:无法读取未定义的属性“SHORT”
\n\n在对象。(node_modules/react-native-simple-toast/index.js:7:23)\n 在对象处。(src/client/components/Catalogue/events.js:10:29)\n 在对象处。(测试/events-test.js:5:13)\n 在 Generator.next ()\n 在 new Promise ()\n 在 Generator.next ()\n 在
\n
该错误是由于从react-native-simple-toast导入Toast造成的。如果没有这个导入,测试运行正常,但我的组件中需要react-native-simple-toast,因此无法删除它。我以某种方式需要测试在我的组件中使用react-native-simple-toast运行:
\n\nimport React, { Component } from 'react'\nimport { Platform, ActivityIndicator, Linking, Dimensions, View, Text, \nTouchableOpacity, TextInput, StyleSheet, Keyboard, Image, \nKeyboardAvoidingView } from 'react-native'\nimport { Container, Header, Card, CardItem, Content, Left, Right, Body, \nTitle, Icon, Button } from 'native-base';\nimport IconIOSback from 'react-native-vector-icons/Ionicons';\nimport IconMenu from 'react-native-vector-icons/MaterialIcons';\nimport axios from 'axios';\nimport SERVER_URL from …
Run Code Online (Sandbox Code Playgroud)