Closed
Description
imo, it would be nice to have a rule that doesn't allow the usage of render
in setup functions (before, beforeEach, etc)
Would also be nice to have the ability to configure custom render functions, we have one for renderWithContext for example.
I've seen people do code like this:
beforeEach(() => {
render(<MyComponent />);
});
it("Should have foo", () => {
expect(screen.getByText("foo")).toBeInTheDocument();
});
it("Should have bar", () => {
expect(screen.getByText("bar")).toBeInTheDocument();
});
it("Should have baz", () => {
expect(screen.getByText("baz")).toBeInTheDocument();
});
imo this should just be a single test. why render it N times when nothing is changing in the render?