import { describe, expect, it } from "vitest";
import { isCargoStateReady } from "@/workers/rpa/kernel/state-engine";

describe("isCargoStateReady", () => {
  it("首页精简 widget：weight 字段可视为就绪", () => {
    expect(
      isCargoStateReady({
        phase: "interactive",
        mountedCargoFields: [],
        interactiveCargoFields: [
          { placeholder: "Weight (lbs)", ariaLabel: null },
        ],
        blockedCargoFields: [],
      }),
    ).toBe(true);
  });

  it("无 pallet/weight 字段时未就绪", () => {
    expect(
      isCargoStateReady({
        phase: "no_cargo_inputs",
        mountedCargoFields: [],
        interactiveCargoFields: [],
        blockedCargoFields: [],
      }),
    ).toBe(false);
  });
});
