This commit is contained in:
Stefan Lazic committed 2026-08-04 09:57:58 +01:00
1 parent 546613e677
commit 4785510144
82 files changed
+4903 -287

No files matched your search

@@ -20,14 +20,19 @@ describe("BrevoEmailProvider", () => {
username: "test-user",
password: "test-pass",
fromAddress: "noreply@example.com",
fromName: "Test Business",
});
beforeEach(() => {
sendMail.mockReset();
});
const params = { to: { email: "customer@example.com" }, subject: "Hi", html: "<p>Hi</p>", text: "Hi" };
const params = {
to: { email: "customer@example.com" },
sender: { name: "Blake Heritage Barbershop" },
subject: "Hi",
html: "<p>Hi</p>",
text: "Hi",
};
it("reports success with the provider message id on a clean send", async () => {
sendMail.mockResolvedValueOnce({ messageId: "<abc123@smtp-relay.brevo.com>" });
@@ -72,4 +77,12 @@ describe("BrevoEmailProvider", () => {
expect(JSON.stringify(result)).not.toContain("test-pass");
expect(JSON.stringify(result)).not.toContain("test-user");
});
it("sends with the per-message sender name and the provider's own configured address, ignoring any sender.email", async () => {
sendMail.mockResolvedValueOnce({ messageId: "<abc123@smtp-relay.brevo.com>" });
await provider.sendEmail({ ...params, sender: { name: "Riverside Barbershop", email: "someone-else@other-domain.com" } });
expect(sendMail).toHaveBeenCalledWith(
expect.objectContaining({ from: { address: "noreply@example.com", name: "Riverside Barbershop" } }),
);
});
});