import * as React from "react";
import { Provider } from "react-redux";
import { renderHook } from "@testing-library/react-hooks";
import configureStore from "redux-mock-store";
import thunk from "redux-thunk";

const mockStore = configureStore([thunk]);

import { useTargetScreenData } from "../useTargetScreenData";

describe("useTargetScreenData", function () {
  const river_id_2 = {};
  const river_id_1 = {};
  const screenId = "river_id_2";
  const entry = { id: "test", type: { value: "video" } };

  const store = mockStore({
    rivers: { river_id_1, river_id_2 },
    contentTypes: { video: { screen_id: screenId } },
  });

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

  it("should return river data for the items screen target", function () {
    const { result } = renderHook(() => useTargetScreenData(entry), {
      wrapper,
    });

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