We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
const context = { name: "foo", id: 1}; const wrapper = mount(<MyComponent />, { context, childContextTypes: { name: PropTypes.string, id: PropTypes.number } }); expect(wrapper.context().name).toBe("foo");
The default context values were initialised as follows:
const MyContext = React.createContext({ id: 0, name: "" });
The test is failing, with the following errors:
expect(received).toBe(expected) // Object.is equality Expected: "foo" Received: "" 22 | }); 23 | > 24 | expect(wrapper.context().name).toBe("foo"); | ^ at Object.toBe (src/App.test.js:24:34) Test Suites: 1 failed, 1 total Tests: 1 failed, 1 total
I expect the value of name to be "foo".
"dependencies": { "react": "^16.7.0", "react-dom": "^16.7.0", "react-scripts": "2.1.2" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, "eslintConfig": { "extends": "react-app" }, "browserslist": [ ">0.2%", "not dead", "not ie <= 11", "not op_mini all" ], "devDependencies": { "enzyme": "^3.8.0", "enzyme-adapter-react-16": "^1.7.1" }
The text was updated successfully, but these errors were encountered:
enzyme does not yet support createContext. See #1553.
Sorry, something went wrong.
No branches or pull requests
The default context values were initialised as follows:
Current behavior
The test is failing, with the following errors:
Expected behavior
I expect the value of name to be "foo".
Your environment
API
Adapter
The text was updated successfully, but these errors were encountered: