import { describe, it, expect } from "vitest";
import { RecordingMailerService } from "@/infrastructure/services/recording-mailer.service";

describe("RecordingMailerService", () => {
  it("records welcome calls", async () => {
    const mailer = new RecordingMailerService();
    await mailer.sendWelcome("u1", "u1@example.com");
    expect(mailer.sent).toEqual([{ userId: "u1", email: "u1@example.com" }]);
  });

  it("preserves call order across multiple sends", async () => {
    const mailer = new RecordingMailerService();
    await mailer.sendWelcome("u1", "a@x");
    await mailer.sendWelcome("u2", "b@x");
    expect(mailer.sent).toEqual([
      { userId: "u1", email: "a@x" },
      { userId: "u2", email: "b@x" },
    ]);
  });
});
