Skip to content

Commit

Permalink
tests added for order
Browse files Browse the repository at this point in the history
  • Loading branch information
fikretellek committed Mar 9, 2024
1 parent a382a93 commit 90e5030
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/components/Order/Order.test.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { describe, expect, it } from "vitest";
import Order from "./Order";
import { render, screen, fireEvent } from "@testing-library/react";

describe("Order", () => {
it("is still rendered on the page", () => {
render(<Order />);

const ordersText = screen.getByText("Orders: 0");

expect(ordersText).toBeInTheDocument();
});

it("button still increases the number of orders", () => {
render(<Order />);

const addButton = screen.getByText("Add");
fireEvent.click(addButton);
const updatedPizzaText = screen.getByText("Orders: 1");

expect(updatedPizzaText).toBeInTheDocument();
});
});

0 comments on commit 90e5030

Please sign in to comment.