mardi 26 septembre 2017

Encountering errors in jest tests

i'm using ARc starter kit (http://ift.tt/2eX68sD) and trying to test my containers and having this error.

I have contianer:

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)

And test for it

import {mapDispatchToProps} from '../AddTodoContainer';
import { addTodoRequest } from 'store/actions';

describe('AddTodoContainer tests', () => {
  it('mapDispatchToProps test', () => {
    expect(mapDispatchToProps).toEqual({addTodo: addTodoRequest})
  })
})

Getting this error:

● 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)

If i'm console.log(mapDispatchToProps)

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)

Aucun commentaire:

Enregistrer un commentaire