How to use the react-test-renderer.create function in react-test-renderer

To help you get started, weโ€™ve selected a few react-test-renderer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github conveyal / analysis-ui / lib / components / modifications-map / __tests__ / stop-select-polygon.js View on Github external
it('renders correctly', () => {
    const props = {
      routeStops: [{
        stop_id: '1',
        stop_lat: 12,
        stop_lon: 34,
        stop_name: 'mock gtfs stop'
      }],
      selectStops: jest.fn()
    }

    // mount component
    const tree = renderer
      .create(
        <map>
          
        </map>
      )
      .toJSON()
    expect(tree).toMatchSnapshot()

    const noCalls = ['selectStops']
    noCalls.forEach(fn =&gt; {
      expect(props[fn]).not.toBeCalled()
    })
  })
})
github conorhastings / react-syntax-highlighter / __tests__ / render-plain-string.js View on Github external
test('SyntaxHighlighter renders childre unadultered when no language disocvered in highlight auto', () =&gt; {
  const tree = renderer
    .create(
      
        {`Contacts* contacts = [[Contacts alloc]init];`}
      
    )
    .toJSON();
  expect(tree).toMatchSnapshot();
});
github FaridSafi / react-native-gifted-form / example / __tests__ / index.ios.js View on Github external
it('renders correctly', () =&gt; {
  const tree = renderer.create(
    
  );
});
github bcgov / tfrs / frontend / __tests__ / app / components / StatusInterceptor.js View on Github external
test('StatusInterceptor should display the proper message for 401 errors', () =&gt; {
  const statusCode = 401;
  const component = renderer.create();

  const tree = component.toJSON();
  expect(tree).toMatchSnapshot();
});
github parkerziegler / github-search / __tests__ / components / Primitives / Error.spec.js View on Github external
it('renders correctly with all required props', () =&gt; {
    const tree = renderer.create().toJSON();
    expect(tree).toMatchSnapshot();
  });
github twilio / TwilioChatJsReactNative / __tests__ / index.js View on Github external
it('renders correctly', () =&gt; {
  const tree = renderer.create(
    
  );
});
github react-cosmos / react-cosmos / packages / react-cosmos-fixture / src / testHelpers / mount.js View on Github external
export async function mount(
  element: Element,
  children: (renderer: ReactTestRenderer) =&gt; Promise
) {
  expect.hasAssertions();

  const renderer = create(element);
  try {
    await children(renderer);
  } finally {
    renderer.unmount();
  }
}
github artsy / emission / src / lib / Components / Inbox / Conversations / __tests__ / Message-tests.tsx View on Github external
.subtract(1, "year")
      .toISOString(),
    body: messageBody,
    is_from_user: true,
    attachments: [],
    from: {
      name: "Percy",
      email: "percy@cat.com",
    },
    invoice: {
      state: "UNPAID",
      total: "$420",
      payment_url: "https://www.adopt-cats.org/pay-here",
    },
  }
  const tree = renderer
    .create(
      
        
      
    )
    .toJSON()
  expect(tree).toMatchSnapshot()
})