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