import { renderHook } from "@testing-library/react-hooks";
import {
  useScreenTrackedViewPositionsContext,
  ScreenTrackedViewPositionsContext,
} from "../";

describe("ScreenTrackedViewPositionsContext", () => {
  it("should return Provider", () => {
    expect(ScreenTrackedViewPositionsContext.Provider).toBeDefined();
  });

  it("should return withProvider", () => {
    expect(ScreenTrackedViewPositionsContext.withProvider).toBeDefined();
  });

  it("should return ReactContext", () => {
    expect(ScreenTrackedViewPositionsContext.ReactContext).toBeDefined();
  });

  it("should return useScreenTrackedViewPositionsContext", () => {
    expect(useScreenTrackedViewPositionsContext).toBeDefined();
  });

  it("should return value", () => {
    const { Provider } = ScreenTrackedViewPositionsContext;

    const contextResult = renderHook(
      () => useScreenTrackedViewPositionsContext(),
      {
        wrapper: Provider,
      }
    ).result.current;

    expect(contextResult).toMatchObject({
      value: expect.any(Object),
      updateComponentsPositions: expect.any(Function),
    });
  });
});
