import { renderHook } from "@testing-library/react-hooks";
import configureStore from "redux-mock-store";

const mockStore = configureStore();

import { useLayoutVersion } from "../useLayoutVersion";
import * as React from "react";
import { Provider } from "react-redux";

describe("useLayoutVersion", () => {
  const layoutVersion = "v1";

  const store = mockStore({
    appData: { layoutVersion },
  });

  const wrapper: React.FC<any> = ({ children }) => (
    <Provider store={store}>{children}</Provider>
  );

  it("should return layout version string if arguments empty", () => {
    const { result } = renderHook(() => useLayoutVersion(), {
      wrapper,
    });

    expect(result.current).toBe(layoutVersion);
  });

  describe("For V1 layout", () => {
    it("should return true for v1", () => {
      const { result } = renderHook(() => useLayoutVersion({ isV1: true }), {
        wrapper,
      });

      expect(result.current).toBe(true);
    });

    it("should return false for v2", () => {
      const { result } = renderHook(() => useLayoutVersion({ isV2: true }), {
        wrapper,
      });

      expect(result.current).toBe(false);
    });
  });
});

describe("useLayoutVersion", () => {});
