Skip to content

Instantly share code, notes, and snippets.

@TimoGlastra
Created November 28, 2018 22:26
Show Gist options
  • Save TimoGlastra/59dd81fcf9915d6066ab75e9f66ec0cf to your computer and use it in GitHub Desktop.
Save TimoGlastra/59dd81fcf9915d6066ab75e9f66ec0cf to your computer and use it in GitHub Desktop.
import React from "react";
import { Text } from "react-native";
import App from "./App";
import renderer from "react-test-renderer";
describe("<App />", () => {
it("renders correctly", () => {
const tree = renderer.create(<App />).toJSON();
expect(tree).toMatchSnapshot();
});
it("renders the correct amount of children", () => {
const component = renderer.create(<App />);
const textInstances = component.root.findAllByType(Text);
expect(textInstances).toHaveLength(3);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment