import { describe, expect, it } from "vitest";
import { cmToIn, kgToLb, toAxelWholeInches, toAxelWholePounds } from "@/modules/quote/unit-converter";

describe("unit-converter", () => {
  it("227kg → 500.45lb（ROUND_HALF_UP，JS 浮点 227×2.20462）", () => {
    expect(kgToLb(227)).toBe(500.45);
  });

  it("122cm → 48.03in", () => {
    expect(cmToIn(122)).toBe(48.03);
  });

  it("120cm 转 axel 尺寸向上取整为 48in", () => {
    expect(toAxelWholeInches(cmToIn(120))).toBe(48);
  });

  it("500kg 转 axel 重量向上取整为 1103lb", () => {
    expect(toAxelWholePounds(kgToLb(500))).toBe(1103);
  });

  it("500lb 不变", () => {
    expect(kgToLb(500 / 2.20462)).toBeCloseTo(500, 0);
  });
});
