import { TINNumber } from "../tin-number";

describe("TINNumber", () => {
  it("debería crear un TINNumber válido", () => {
    const result = TINNumber.create("12345");
    expect(result.isSuccess).toBe(true);
    expect(result.data.getProps()).toBe("12345");
  });

  it("debería fallar si el valor es demasiado corto", () => {
    const result = TINNumber.create("1");
    expect(result.isFailure).toBe(true);
    expect(result.error?.message).toBe("TIN must be at least 2 characters long");
  });

  it("debería fallar si el valor es demasiado largo", () => {
    const result = TINNumber.create("12345678901");
    expect(result.isFailure).toBe(true);
    expect(result.error?.message).toBe("TIN must be at most 10 characters long");
  });

  it("debería devolver el valor correcto en toString()", () => {
    const result = TINNumber.create("ABC123");
    expect(result.isSuccess).toBe(true);
    expect(result.data.toString()).toBe("ABC123");
  });
});
