import { composeStories } from "@storybook/react"
import { screen } from "@testing-library/react"
import { userEvent } from "@testing-library/user-event"
import React from "react"
import { expect, describe, test } from "vitest"
import { render } from "../../../tests/render"
import * as stories from "./SwitchPill.stories"

const { Default } = composeStories(stories)

describe("<SwitchPill />", () => {
  test("Default", async () => {
    render(<Default />)
    const toggle = await screen.findByRole("switch", { name: "On auction" })
    expect(toggle).not.toBeChecked()
    await userEvent.click(toggle)
    expect(toggle).toBeChecked()
  })
})
