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

import { orientationWasChangedFromPortraitToLandscape } from "..";

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

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

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

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

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

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

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

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