import { FLOW_DISPLAY_UNIT, isLpsFlowProperty, toM3h } from "./units";

describe("flow display units", () => {
  it("uses cubic meters per hour as the flow display unit", () => {
    expect(FLOW_DISPLAY_UNIT).toBe("m³/h");
  });

  it("converts L/s values to m³/h", () => {
    expect(toM3h(10, "lps")).toBe(36);
    expect(toM3h(10, "L/s")).toBe(36);
  });

  it("recognizes computed properties that arrive from the backend in L/s", () => {
    expect(isLpsFlowProperty("flow")).toBe(true);
    expect(isLpsFlowProperty("actual_demand")).toBe(true);
    expect(isLpsFlowProperty("actualdemand")).toBe(true);
    expect(isLpsFlowProperty("pressure")).toBe(false);
  });
});
