import { describe, expect, it } from "vitest";
import { slugField } from "./slug-field";

describe("slugField", () => {
  it("returns a Payload Field with default name 'slug'", () => {
    const field = slugField();
    if (field.type !== "text") throw new Error("expected text field");
    expect(field.name).toBe("slug");
    expect(field.required).toBe(true);
    expect(field.unique).toBe(true);
    expect(field.index).toBe(true);
  });

  it("accepts a custom field name", () => {
    const field = slugField("permalink");
    if (field.type !== "text") throw new Error("expected text field");
    expect(field.name).toBe("permalink");
  });
});
