import {
  getSlideTemplateAvailability,
  slideTemplateAvailabilityByDisplayMode,
  slideTemplateAvailabilityList
} from "../../packages/slide-contracts/src/metadata";

describe("slide template availability metadata", () => {
  it("lists EquationFocus once per supported display mode", () => {
    const equationEntries = slideTemplateAvailabilityList.filter(
      (definition) => definition.componentKey === "EquationFocus"
    );

    expect(equationEntries).toHaveLength(2);
    expect(equationEntries.map((entry) => entry.displayMode).sort()).toEqual([
      "fullscreen",
      "square"
    ]);
  });

  it("keeps square-only templates out of fullscreen availability", () => {
    expect(
      slideTemplateAvailabilityByDisplayMode.fullscreen.some(
        (definition) => definition.componentKey === "SquareYellow"
      )
    ).toBe(false);
  });

  it("can return availability for a specific display mode", () => {
    const squareTemplates = getSlideTemplateAvailability("square");

    expect(
      squareTemplates.some(
        (definition) =>
          definition.componentKey === "EquationFocus" &&
          definition.displayMode === "square"
      )
    ).toBe(true);
  });
});
