Skip to content

Scheduling infrastructure for absolutely everyone.

1.1 KB
Raw Blame
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]");
  });
});