forked from CodeYourFuture/React-Module-Project
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a382a93
commit 90e5030
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}); | ||
}); |