import { jsx } from "react/jsx-runtime";
import React from "react";
import { render, fireEvent } from "@testing-library/react-native";
import Checkbox from "..";
import ThemeProvider from "../../Theme";
jest.useFakeTimers();
describe("<Checkbox />", () => {
  describe("<Checkbox.Switch />", () => {
    describe("Snapshots", () => {
      it("should match snapshot with default switch", () => {
        const { toJSON } = render(
          /* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Checkbox.Switch, {}) })
        );
        expect(toJSON()).toMatchSnapshot();
      });
      it("should match snapshot with disabled switch", () => {
        const { toJSON } = render(
          /* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Checkbox.Switch, { disabled: true }) })
        );
        expect(toJSON()).toMatchSnapshot();
      });
      it("should match snapshot with checked switch", () => {
        const { toJSON } = render(
          /* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Checkbox.Switch, { checked: true }) })
        );
        expect(toJSON()).toMatchSnapshot();
      });
      it("should match snapshot with disabled and checked switch", () => {
        const { toJSON } = render(
          /* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(Checkbox.Switch, { disabled: true, checked: true }) })
        );
        expect(toJSON()).toMatchSnapshot();
      });
      it("should call onChange function when click on Checkbox.Switch", () => {
        const onChangeMock = jest.fn();
        const { getByRole } = render(
          /* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(
            Checkbox.Switch,
            {
              onChange: onChangeMock,
              accessibilityRole: "button"
            }
          ) })
        );
        fireEvent.press(getByRole("button"));
        expect(onChangeMock).toHaveBeenCalled();
      });
    });
  });
});
