×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Mike Rourke
Added: Nov 6, 2017 3:09 PM
Views: 4
Tags: jest react
Function to setup test for React rendering.
  1. const setup = (propOverrides, renderFn = shallow) => {
  2.   const props = {
  3.    
  4.     isLoading: false,
  5.     ...propOverrides,
  6.   };
  7.  
  8.   const wrapper = renderFn(<[Component Name] {...props} />);
  9.  
  10.   return { props, wrapper };
  11. };