From ed2caba7ba8465fbcff5f5ead8ca9e1700a213ab Mon Sep 17 00:00:00 2001 From: areebsattar Date: Sun, 24 Mar 2024 21:09:08 +0000 Subject: [PATCH] Tests Added --- .../RestaurantButton/RestaurantButton.jsx | 2 +- .../RestaurantButton/RestaurantButton.test.jsx | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/components/RestaurantButton/RestaurantButton.jsx b/src/components/RestaurantButton/RestaurantButton.jsx index b297520..48d56eb 100644 --- a/src/components/RestaurantButton/RestaurantButton.jsx +++ b/src/components/RestaurantButton/RestaurantButton.jsx @@ -3,7 +3,7 @@ function RestaurantButton({ OrderOne }) { return ( <> ); diff --git a/src/components/RestaurantButton/RestaurantButton.test.jsx b/src/components/RestaurantButton/RestaurantButton.test.jsx index e69de29..5c2e1f2 100644 --- a/src/components/RestaurantButton/RestaurantButton.test.jsx +++ b/src/components/RestaurantButton/RestaurantButton.test.jsx @@ -0,0 +1,16 @@ +import { describe, it, expect } from "vitest"; +import { render, fireEvent } from '@testing-library/react'; +import RestaurantButton from "./RestaurantButton"; + +describe('RestaurantButton', () => { + it('increments the number of pizzas when the button is clicked', () => { + const mockOrderOne = () => { + mockOrderOne.called = true; + }; + + const { getByText } = render(); + const addButton = getByText('Add'); + fireEvent.click(addButton); + expect(mockOrderOne.called).toBe(true); + }); +}); \ No newline at end of file