Skip to content

Commit

Permalink
test: remove render from beforeEach
Browse files Browse the repository at this point in the history
Signed-off-by: rare-magma <[email protected]>
  • Loading branch information
rare-magma committed Apr 24, 2024
1 parent 011a023 commit 3fcef04
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/components/CalculateButton/CalculateButton.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,20 @@ describe("CalculateButton", () => {
/>
);

beforeEach(() => {
render(comp);
});

it("matches snapshot", () => {
render(comp);
expect(comp).toMatchSnapshot();
});

it("renders initial state", async () => {
render(comp);
expect(
await screen.findByLabelText("select operation type to item value"),
).toBeInTheDocument();
});

it("opens popover when clicking the button", async () => {
render(comp);
const button = screen.getByRole("button", {
name: "select operation type to item value",
});
Expand All @@ -50,6 +49,7 @@ describe("CalculateButton", () => {
});

it("closes when clicking the button", async () => {
render(comp);
const button = screen.getByRole("button", {
name: "select operation type to item value",
});
Expand All @@ -65,6 +65,7 @@ describe("CalculateButton", () => {
});

it("closes when pressing Escape key", async () => {
render(comp);
const button = screen.getByRole("button", {
name: "select operation type to item value",
});
Expand All @@ -80,6 +81,7 @@ describe("CalculateButton", () => {
});

it("calls onCalculate when accepting change > 0", async () => {
render(comp);
const button = screen.getByRole("button", {
name: "select operation type to item value",
});
Expand All @@ -95,6 +97,7 @@ describe("CalculateButton", () => {
});

it("calls onCalculate when change > 0 and enter is pressed", async () => {
render(comp);
const button = screen.getByRole("button", {
name: "select operation type to item value",
});
Expand All @@ -106,6 +109,7 @@ describe("CalculateButton", () => {
});

it("calls onCalculate with sub", async () => {
render(comp);
const button = screen.getByRole("button", {
name: "select operation type to item value",
});
Expand All @@ -123,6 +127,7 @@ describe("CalculateButton", () => {
});

it("calls onCalculate with multiply", async () => {
render(comp);
const button = screen.getByRole("button", {
name: "select operation type to item value",
});
Expand All @@ -140,6 +145,7 @@ describe("CalculateButton", () => {
});

it("calls onCalculate with div", async () => {
render(comp);
const button = screen.getByRole("button", {
name: "select operation type to item value",
});
Expand All @@ -157,6 +163,7 @@ describe("CalculateButton", () => {
});

it("shows history when clicking button", async () => {
render(comp);
const button = screen.getByRole("button", {
name: "select operation type to item value",
});
Expand Down

0 comments on commit 3fcef04

Please sign in to comment.