Files
calendar/packages/lib/getReplyToEmail.test.ts
2025-04-23 06:44:44 -07:00

38 lines
1.1 KiB
TypeScript

import type { TFunction } from "i18next";
import { describe, expect, it } from "vitest";
import { getReplyToEmail } from "./getReplyToEmail";
describe("getReplyToEmail", () => {
it("returns the customReplyToEmail if it is set", () => {
const calEvent = {
customReplyToEmail: "[email protected]",
organizer: {
name: "Organizer",
email: "[email protected]",
timeZone: "UTC",
language: {
locale: "en",
translate: ((key: string) => key) as TFunction,
},
},
};
expect(getReplyToEmail(calEvent)).toBe("[email protected]");
});
it("returns the organizer's email if customReplyToEmail is not set", () => {
const calEvent = {
customReplyToEmail: null,
organizer: {
name: "Organizer",
email: "[email protected]",
timeZone: "UTC",
language: {
locale: "en",
translate: ((key: string) => key) as TFunction,
},
},
};
expect(getReplyToEmail(calEvent)).toBe("[email protected]");
});
});