test-props
Testing utility for creating flexible react props
Why?
Because I have duplicated the same createProps
function over and over again in every React component
test I've written for 2 years.
testProps.propsFactory
defaultProps -> customProps -> Object
Make props and
; const createMyProps = // Make default props all you want// {foo: 'bar', beep: 'boop'} // Customize them when you need to.;// {foo: 'baz', beep: 'boop'}
testProps.elementFactory
(React, Component, defaultProps) -> customProps -> [ReactElement, props]
;;;; const Greeting = <div>propsgreeting propstoWhat</div> // You get to reuse this in all your tests until you want to customize// the props you pass to the element.const createGreeting = ; ;