enzyme-to-json-mock-props
it gives you the ability to mock props generated via
enzyme-to-json
.
Install
npm install enzyme-to-json-mock-props
Example
Assuming you are using enzyme-to-json/serializer
as snapshotSerializers
, example.
;;; const SubComponent = <div />; const Component = <SubComponent ...props style= background: "red" color: "black" />; ;
before (without mockProps
):
exports`enzyme-to-json-mock-props should render properly 1` = `<SubComponent asd={ Object { "qwe": 321, } } foo={ Object { "bar": 123, } } foobar="asd" style={ Object { "background": "red", "color": "black", } }/>`;
after (with mockProps
):
exports`enzyme-to-json-mock-props should mock the indicated props 1` = `<SubComponent asd={ Object { "qwe": 321, } } foo="[foo]" foobar="[foobar]" style="[style]"/>`;