diff --git a/src/components/App/App.jsx b/src/components/App/App.jsx
index ad25322..5f301e4 100644
--- a/src/components/App/App.jsx
+++ b/src/components/App/App.jsx
@@ -3,14 +3,14 @@ import "./App.scss";
import AppHeader from "../AppHeader/AppHeader.jsx";
import Card from "../Card/Card";
import Footer from "../Footer/Footer";
-
-
+import Restaurant from "../Restaurant/Restaurant.jsx";
const App = () => (
);
diff --git a/src/components/Restaurant/Restaurant.jsx b/src/components/Restaurant/Restaurant.jsx
index 378b963..d8f9dae 100644
--- a/src/components/Restaurant/Restaurant.jsx
+++ b/src/components/Restaurant/Restaurant.jsx
@@ -1,12 +1,20 @@
+import React, { useState } from "react";
+
const Restaurant = () => {
- const pizzas = 0;
+ const [orders, setOrders] = useState(0);
+ const handleAddOrder = () => {
+ setOrders(orders + 1);
+ };
+
return (
Restaurant Orders
-
- Pizzas: {pizzas}{" "}
-
+ Orders: {orders}
+
diff --git a/src/components/Restaurant/Restaurant.test.jsx b/src/components/Restaurant/Restaurant.test.jsx
index 6bcfaf4..dec0ad0 100644
--- a/src/components/Restaurant/Restaurant.test.jsx
+++ b/src/components/Restaurant/Restaurant.test.jsx
@@ -1,6 +1,6 @@
import Restaurant from "./Restaurant.jsx";
import { describe, it, expect } from "vitest";
-import { render, screen } from "@testing-library/react";
+import { render, screen, fireEvent } from "@testing-library/react";
describe("Restaurant", () => {
it("renders an Orders heading", () => {
@@ -11,3 +11,23 @@ describe("Restaurant", () => {
expect(titleElement).toBeInTheDocument();
});
});
+
+describe("Restaurant Component", () => {
+ it("displays initial number of pizza 0", () => {
+ render();
+ const pizzaText = screen.getByText("Orders: 0");
+ expect(pizzaText).toBeInTheDocument();
+ });
+
+ it("increase number of pizzas when 'Add' button is clicked", () => {
+ render();
+
+ const addButton = screen.getByText("Add");
+
+ fireEvent.click(addButton);
+
+ const updatedPizzaText = screen.getByText("Orders: 1");
+
+ expect(updatedPizzaText).toBeInTheDocument();
+ });
+});