import { Slug } from "../slug"; // Ajusta la ruta según corresponda

describe("Slug Value Object", () => {
  test("Debe crear un Slug válido", () => {
    const slugResult = Slug.create("valid-slug-123");
    expect(slugResult.isSuccess).toBe(true);
    expect(slugResult.data.getProps()).toBe("valid-slug-123");
  });

  test("Debe fallar si el Slug contiene caracteres inválidos", () => {
    const slugResult = Slug.create("Invalid_Slug!");
    expect(slugResult.isSuccess).toBe(false);
    expect(slugResult.error).toBeInstanceOf(Error);
  });

  test("Debe fallar si el Slug tiene menos de 2 caracteres", () => {
    const slugResult = Slug.create("a");
    expect(slugResult.isSuccess).toBe(false);
    expect(slugResult.error).toBeInstanceOf(Error);
  });

  test("Debe fallar si el Slug tiene más de 100 caracteres", () => {
    const longSlug = "a".repeat(101);
    const slugResult = Slug.create(longSlug);
    expect(slugResult.isSuccess).toBe(false);
    expect(slugResult.error).toBeInstanceOf(Error);
  });
});
