import { describe, it, expect } from "vitest";
import {
  OC_SIZES,
  resolveOrgchartNodeType,
  resolveOrgchartEdgeType,
} from "./constants";

describe("OC_SIZES", () => {
  it("should have person dimensions", () => {
    expect(OC_SIZES.person.w).toBe(280);
    expect(OC_SIZES.person.h).toBe(80);
  });
});

describe("resolveOrgchartNodeType", () => {
  it("should resolve org:person to orgchartPerson", () => {
    expect(resolveOrgchartNodeType("org:person")).toBe("orgchartPerson");
  });

  it("should resolve bare person to orgchartPerson", () => {
    expect(resolveOrgchartNodeType("person")).toBe("orgchartPerson");
  });

  it("should default unknown types to orgchartPerson", () => {
    expect(resolveOrgchartNodeType("org:unknown")).toBe("orgchartPerson");
    expect(resolveOrgchartNodeType("foo")).toBe("orgchartPerson");
  });
});

describe("resolveOrgchartEdgeType", () => {
  it("should return orgchartHierarchy for any edge type", () => {
    expect(resolveOrgchartEdgeType("hierarchy")).toBe("orgchartHierarchy");
    expect(resolveOrgchartEdgeType(undefined)).toBe("orgchartHierarchy");
    expect(resolveOrgchartEdgeType("other")).toBe("orgchartHierarchy");
  });
});
