You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This code works when running the app as i'm receiving the context. But when testing the context is just an empty object.
Note: When moving Dummy.contextType = Context to
Dummy.contextTypes = {
a: PropTypes.number,
...
}
the context is correctly defined. But as i'm using the new API this is not possible. I also test with mount but with the same result. Also i tried to upgrade enzyme and the adapter to the latest version without success.
Expected behavior
The context should be declared on the component and in the test when running wrapper.context()
API
shallow
mount
render
Version
library
version
enzyme
^3.9.0
react
^16.8.2
react-dom
^16.8.2
react-test-rendered
N/A
adapter (below)
Adapter
enzyme-adapter-react-16
enzyme-adapter-react-16.3
enzyme-adapter-react-16.2
enzyme-adapter-react-16.1
enzyme-adapter-react-15
enzyme-adapter-react-15.4
enzyme-adapter-react-14
enzyme-adapter-react-13
enzyme-adapter-react-helper
others ( )
The text was updated successfully, but these errors were encountered:
Current behavior
context.js: This file just creates the context with the new Context API.
provider.js: This is a wrapper that meant to declare the elements that should be passed to the context.
dummy.js: This component uses the context.
dummy.spec.js: This is the test that should run.
This code works when running the app as i'm receiving the context. But when testing the context is just an empty object.
Note: When moving
Dummy.contextType = Context
tothe context is correctly defined. But as i'm using the new API this is not possible. I also test with
mount
but with the same result. Also i tried to upgrade enzyme and the adapter to the latest version without success.Expected behavior
The context should be declared on the component and in the test when running
wrapper.context()
API
Version
Adapter
The text was updated successfully, but these errors were encountered: