import { getButtonsCount } from "..";

describe("getButtonsCount", () => {
  const prefix = "tv_buttons";

  it("count buttons inside configuration", () => {
    const configuration = {};

    const result = getButtonsCount(configuration, prefix);

    expect(result).toEqual(0);
  });

  it("count buttons inside configuration", () => {
    const configuration = {
      tv_buttons_button_1_button_enabled: true,
      tv_buttons_button_2_button_enabled: false,
      tv_buttons_button_3_button_enabled: false,
    };

    const result = getButtonsCount(configuration, prefix);

    expect(result).toEqual(1);
  });

  it("count buttons inside configuration", () => {
    const configuration = {
      tv_buttons_button_1_button_enabled: true,
      tv_buttons_button_2_button_enabled: true,
      tv_buttons_button_3_button_enabled: false,
    };

    const result = getButtonsCount(configuration, prefix);

    expect(result).toEqual(2);
  });

  it("count buttons inside configuration", () => {
    const configuration = {
      tv_buttons_button_1_button_enabled: true,
      tv_buttons_button_2_button_enabled: true,
      tv_buttons_button_3_button_enabled: true,
    };

    const result = getButtonsCount(configuration, prefix);

    expect(result).toEqual(3);
  });

  it("count buttons inside configuration", () => {
    const configuration = {
      tv_buttons_button_1_button_enabled: true,
      tv_buttons_button_2_button_enabled: false,
      tv_buttons_button_3_button_enabled: true,
    };

    const result = getButtonsCount(configuration, prefix);

    expect(result).toEqual(2);
  });
});
