Skip to content

Instantly share code, notes, and snippets.

@pustovalov
Last active May 19, 2020 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pustovalov/b50cb9585432fc4cad278148d476edb5 to your computer and use it in GitHub Desktop.
Save pustovalov/b50cb9585432fc4cad278148d476edb5 to your computer and use it in GitHub Desktop.
import { render, screen } from "@testing-library/react";
import { MyComponent } from "./MyComponent";
const defaultProps = {
size: "large",
color: "salmon",
butiful: true,
};
describe("MyComponent", () => {
it("should render a butiful component", () => {
render(<MyComponent {...defaultProps} />);
expect(screen.getByText(/I am butiful/i)).toBeInTheDocument();
});
it("should render an ugly component", () => {
render(
<MyComponent {...defaultProps} butiful={false} />
);
expect(screen.queryByText(/I am butiful/i)).not.toBeInTheDocument();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment