Javascript 在jest测试中遇到错误
我正在使用arcstarterkit()并尝试测试我的容器,但出现了此错误 我有一个问题:Javascript 在jest测试中遇到错误,javascript,testing,jestjs,Javascript,Testing,Jestjs,我正在使用arcstarterkit()并尝试测试我的容器,但出现了此错误 我有一个问题: import {connect} from 'react-redux'; import { addTodoRequest } from 'store/actions'; import { AddTodo } from 'components' export const mapDispatchToProps = { addTodo: addTodoRequest } export default
import {connect} from 'react-redux';
import { addTodoRequest } from 'store/actions';
import { AddTodo } from 'components'
export const mapDispatchToProps = {
addTodo: addTodoRequest
}
export default connect(null, mapDispatchToProps)(AddTodo)
并对其进行测试
import {mapDispatchToProps} from '../AddTodoContainer';
import { addTodoRequest } from 'store/actions';
describe('AddTodoContainer tests', () => {
it('mapDispatchToProps test', () => {
expect(mapDispatchToProps).toEqual({addTodo: addTodoRequest})
})
})
获取此错误:
● AddTodoContainer tests › mapDispatchToProps test
TypeError: iterator.next is not a function
at printIteratorEntries (node_modules/pretty-format/build/collections.js:170:183)
at printImmutableEntries (node_modules/pretty-format/build/plugins/immutable.js:44:39)
at Object.<anonymous>.exports.serialize (node_modules/pretty-format/build/plugins/immutable.js:179:12)
at printPlugin (node_modules/pretty-format/build/index.js:245:10)
at printer (node_modules/pretty-format/build/index.js:290:12)
at printObjectProperties (node_modules/pretty-format/build/collections.js:180:21)
at printComplexValue (node_modules/pretty-format/build/index.js:232:42)
at prettyFormat (node_modules/pretty-format/build/index.js:446:10)
at pass (node_modules/expect/build/matchers.js:429:49)
at getMessage (node_modules/expect/build/index.js:107:16)
at Object.throwingMatcher [as toEqual] (node_modules/expect/build/index.js:215:23)
at Object.<anonymous> (src/containers/__tests__/AddTodoContainer.test.js:6:50)
● AddTodoContainer测试›mapDispatchToProps测试
TypeError:iterator.next不是函数
在printIteratorEntries(node_modules/pretty format/build/collections.js:170:183)
在printImmutableEntries(node_modules/pretty format/build/plugins/immutable.js:44:39)
at Object..exports.serialize(node_modules/pretty format/build/plugins/immutable.js:179:12)
在printPlugin(node_modules/pretty format/build/index.js:245:10)
在打印机上(node_modules/pretty format/build/index.js:290:12)
在printObjectProperties(node_modules/pretty format/build/collections.js:180:21)
在printComplexValue(node_modules/pretty format/build/index.js:232:42)
在prettyFormat(node_modules/pretty format/build/index.js:446:10)
通过时(node_modules/expect/build/matchers.js:429:49)
在getMessage(node_modules/expect/build/index.js:107:16)
在Object.throwingMatcher[as toEqual](node_modules/expect/build/index.js:215:23)
反对。(src/containers/\uuuuu tests\uuuu/AddTodoContainer.test.js:6:50)
如果我是console.log(mapDispatchToProps)
TypeError:无法将符号值转换为字符串
代理。(private/jest/actionsMock.js:5:67)
at formatValue(util.js:351:36)
at formattroperty(util.js:792:15)
在util.js:652:12
at Array.map(本机)
在formatObject上(util.js:651:15)
at formatValue(util.js:591:16)
检查时(util.js:185:10)
at exports.format(util.js:71:24)
反对。(src/containers/\uuuuu tests\uuuu/AddTodoContainer.test.js:9:13)
TypeError: Cannot convert a Symbol value to a string
at Proxy.<anonymous> (private/jest/actionsMock.js:5:67)
at formatValue (util.js:351:36)
at formatProperty (util.js:792:15)
at util.js:652:12
at Array.map (native)
at formatObject (util.js:651:15)
at formatValue (util.js:591:16)
at inspect (util.js:185:10)
at exports.format (util.js:71:24)
at Object.<anonymous> (src/containers/__tests__/AddTodoContainer.test.js:9:13)