import { ORIENTATIONS } from "@applicaster/zapp-react-native-utils/appUtils/orientationHelper";

import { orientationWasChangedFromLandscapeToPortrait } from "..";

describe("orientationWasChangedFromLandscapeToPortrait", () => {
  it("return true for from=landscape and to=portrait ", () => {
    const fromOrientation = ORIENTATIONS.landscapeLeft;
    const toOrientation = ORIENTATIONS.portrait;

    expect(
      orientationWasChangedFromLandscapeToPortrait({
        fromOrientation,
        toOrientation,
      })
    ).toBe(true);
  });

  it("return false for from=portrait to=landscape ", () => {
    const fromOrientation = ORIENTATIONS.portrait;
    const toOrientation = ORIENTATIONS.landscapeLeft;

    expect(
      orientationWasChangedFromLandscapeToPortrait({
        fromOrientation,
        toOrientation,
      })
    ).toBe(false);
  });

  it("return true for from=unknown to=portrait ", () => {
    const fromOrientation = ORIENTATIONS.unknown;
    const toOrientation = ORIENTATIONS.portrait;

    expect(
      orientationWasChangedFromLandscapeToPortrait({
        fromOrientation,
        toOrientation,
      })
    ).toBe(true);
  });

  it("return false for from=unknown to=landscape", () => {
    const fromOrientation = ORIENTATIONS.unknown;
    const toOrientation = ORIENTATIONS.landscapeLeft;

    expect(
      orientationWasChangedFromLandscapeToPortrait({
        fromOrientation,
        toOrientation,
      })
    ).toBe(false);
  });
});
