Closed cgungaloo closed 6 years ago
I got this error When trying to run the following test
it('Button click calls onAdd', () =>{ const button = add.find('button').first(); const input =add.find('input').first(); input.simulate('change',{target:{value:'Name 4'}}); button.simulate('click'); expect(onAdd).toBeCalledWith('Name 4'); });
error:
TypeError: received.getMockName is not a function
at Object.it (src/__tests__/add.test.js:33:34) at new Promise (<anonymous>) at Promise.resolve.then.el (node_modules/p-map/index.js:46:16) at <anonymous>
My package.json file { "name": "codementor_test", "version": "0.1.0", "private": true, "dependencies": { "enzyme": "^3.3.0", "enzyme-adapter-react-16": "^1.1.1", "react": "^16.3.1", "react-scripts": "1.1.4", "react-test-renderer": "^16.3.1" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test --env=jsdom", "eject": "react-scripts eject" }, "devDependencies": { "expect": "^22.4.3", "jest-mock": "^22.4.3", "p-map": "^1.2.0", "react-dom": "^16.3.1" } }
Thanks for looking at this
expect v22+ is maintained by the jest team; this repo is for earlier versions.
Thanks, I didnt know that.
I got this error When trying to run the following test
it('Button click calls onAdd', () =>{ const button = add.find('button').first(); const input =add.find('input').first(); input.simulate('change',{target:{value:'Name 4'}}); button.simulate('click'); expect(onAdd).toBeCalledWith('Name 4'); });
error:
TypeError: received.getMockName is not a function
My package.json file { "name": "codementor_test", "version": "0.1.0", "private": true, "dependencies": { "enzyme": "^3.3.0", "enzyme-adapter-react-16": "^1.1.1", "react": "^16.3.1", "react-scripts": "1.1.4", "react-test-renderer": "^16.3.1" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test --env=jsdom", "eject": "react-scripts eject" }, "devDependencies": { "expect": "^22.4.3", "jest-mock": "^22.4.3", "p-map": "^1.2.0", "react-dom": "^16.3.1" } }
Thanks for looking at this