import { describe, expect, it } from "vitest";
import { normalizeCargoEvidence } from "@/workers/rpa/kernel/normalize";

describe("normalizeCargoEvidence", () => {
  it("undefined → 空 evidence", () => {
    expect(normalizeCargoEvidence(undefined).phase).toBe("no_cargo_inputs");
    expect(normalizeCargoEvidence(undefined).mountedCargoFields).toEqual([]);
  });

  it("数组字段 undefined → []", () => {
    const evidence = normalizeCargoEvidence({
      phase: "hydrating",
      mountedCargoFields: undefined as never,
      interactiveCargoFields: undefined as never,
      blockedCargoFields: undefined as never,
    });
    expect(evidence.mountedCargoFields).toEqual([]);
  });
});
