import { describe, it, expect, beforeEach } from "vitest";
import { mediaFactory } from "@/__factories__/media.factory";

describe("mediaFactory", () => {
  beforeEach(() => mediaFactory.reset());

  it("returns a Media object with stable defaults", () => {
    const m = mediaFactory.build();
    expect(m.id).toBe("media-1");
    expect(m.alt).toBe("Media 1");
    expect(m.mimeType).toBe("image/png");
    expect(m.filesize).toBe(1024);
  });

  it("applies overrides", () => {
    const m = mediaFactory.build({ alt: "Custom alt", mimeType: "image/jpeg" });
    expect(m.alt).toBe("Custom alt");
    expect(m.mimeType).toBe("image/jpeg");
    expect(m.id).toBe("media-1");
  });

  it("increments sequence per build", () => {
    const a = mediaFactory.build();
    const b = mediaFactory.build();
    expect(a.id).toBe("media-1");
    expect(b.id).toBe("media-2");
  });
});
