From 7b4811ef07fd384a86fe087703e96bb52b6ebc21 Mon Sep 17 00:00:00 2001 From: areebsattar Date: Sun, 24 Mar 2024 21:00:13 +0000 Subject: [PATCH] Test Added --- src/components/Order/Order.test.jsx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/components/Order/Order.test.jsx b/src/components/Order/Order.test.jsx index e69de29..06155c8 100644 --- a/src/components/Order/Order.test.jsx +++ b/src/components/Order/Order.test.jsx @@ -0,0 +1,20 @@ +import { render, fireEvent, screen } from "@testing-library/react"; +import { describe, it, expect } from "vitest"; +import Order from "./Order"; + + +describe('Order', () => { + it('renders pizza on the page', () => { + render(); + const pizzaOrder = screen.getByText('Pizzas: 0'); + expect(pizzaOrder).toBeInTheDocument(); + }); + + it('increments the number of order when "Add" button is clicked', () => { + render(); + const addButton = screen.getByText('Add Pizzas'); + fireEvent.click(addButton); + const updatedPizzaOrder = screen.getByText('Pizzas: 1'); + expect(updatedPizzaOrder).toBeInTheDocument(); + }); +}) \ No newline at end of file