API
Last updated
Was this helpful?
Last updated
Was this helpful?
createMount(plugins) => (node: React.ReactElement, options? Object) => ContextReactWrapper
plugins
(Object
): an object where the keys are names of your choice and the values are enzyme-context
s.
A mount function: (node: React.ReactElement, options?: Object) => ContextReactWrapper
: A function that takes the same arguments as but can also accept additional options
(as specified by the provided plugins
.)
Arguments
node
(React.ReactElement
): The node to render
options
(Object
[optional]): The same options that can be passed to plus any options the plugins you've added handle.
Returns
A ReactWrapper
with the following attributes:
[keyof plugins]: EnzymePlugin['controller']
: the returned ReactWrapper
will have a key that matches each key in the plugins
you provide. The value will be whatever the plugin provides. For example, the enzyme-context-redux
plugin provides a Store
; the enzyme-context-react-router-4
plugin provides a History
.
test-utils/enzyme.ts
MyComponent.spec.tsx
createShallow(plugins) => (node: React.ReactElement, options? Object) => ContextShallowWrapper
Arguments
node
(React.ReactElement
): The node to render
Returns
An ShallowWrapper
with the following attributes:
test-utils/enzyme.ts
MyComponent.spec.tsx
plugins
(Object
): an object where the keys are names of your choice and the values are enzyme-context
s.
A shallow function: (node: React.ReactElement, options?: Object) => ContextShallowWrapper
: A function that takes the same arguments as but can also accept additional options
(as specified by the provided plugins
.)
options
(Object
[optional]): The same options that can be passed to plus any options the plugins you've added handle.
[keyof plugins]: EnzymePlugin['controller']
: the returned object will have a key that matches each key in the plugins
you provide. The value will be whatever the plugin provides. For example, the enzyme-context-redux
plugin provides a Store
; the enzyme-context-react-router-4
plugin provides a History
.