import React from "react";
import { render } from "@testing-library/react";
import "@testing-library/jest-dom";
import { SwitchProps } from "../SwitchProps";
import Switch from "../Switch";

describe("Switch Component", () => {
  const props: SwitchProps = {
    accessKey: "a",
    ariaDescribedBy: "description-id",
    ariaLabel: "switch-label",
    ariaLabelledBy: "label-id",
    checked: true,
    className: "switch-class",
    defaultChecked: false,
    defaultValue: true,
    dir: "ltr",
    disabled: false,
    id: "switch-id",
    name: "switch-name",
    offLabel: "Off",
    onLabel: "On",
    required: false,
    size: "medium",
    tabIndex: 0,
    thumbRounded: "full",
    trackRounded: "full",
    valid: true,
    validationMessage: "",
    validityStyles: true,
    value: true
  };

  it("renders all props correctly", () => {
    render(<Switch {...props} />);
  });

  it("matches the snapshot", () => {
    const { asFragment } = render(<Switch {...props} />);
    expect(asFragment()).toMatchSnapshot();
  });
});
