Raw
1 import { render, screen } from "@testing-library/react"
2 import * as React from "react"
3
4 import { Button } from "./button"
5
6 describe("Button", () => {
7 it("renders a button", () => {
8 render(<Button>Click me</Button>)
9 const button = screen.getByRole("button", { name: "Click me" })
10 expect(button).toBeInTheDocument()
11 })
12
13 it("renders a button as a link", () => {
14 render(
15 <Button asChild>
16 <a href="https://www.medusajs.com">Go to website</a>
17 </Button>
18 )
19
20 const button = screen.getByRole("link", { name: "Go to website" })
21 expect(button).toBeInTheDocument()
22 })
23 })