assessment-model/src/app/email_templates/buildMailHeaders.test.ts
Khalim Conn-Kowlessar e57e4ab750 changing email to test
2026-05-27 15:01:26 +00:00

31 lines
1 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { buildMailHeaders } from "./buildMailHeaders";
describe("buildMailHeaders", () => {
it("includes X-SES-CONFIGURATION-SET when a configuration set is provided", () => {
const headers = buildMailHeaders({
fromAddress: "test-sender@example.test",
sesConfigurationSet: "test-config-set",
});
expect(headers["X-SES-CONFIGURATION-SET"]).toBe("test-config-set");
});
it("omits X-SES-CONFIGURATION-SET entirely when no configuration set is provided", () => {
const headers = buildMailHeaders({
fromAddress: "test-sender@example.test",
sesConfigurationSet: undefined,
});
expect(headers).not.toHaveProperty("X-SES-CONFIGURATION-SET");
});
it("always includes a List-Unsubscribe mailto pointing at the from address", () => {
const headers = buildMailHeaders({
fromAddress: "test-sender@example.test",
sesConfigurationSet: undefined,
});
expect(headers["List-Unsubscribe"]).toBe("<mailto:test-sender@example.test>");
});
});