Last active
May 19, 2020 16:29
-
-
Save pustovalov/b50cb9585432fc4cad278148d476edb5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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