src/features/reviews/search.helpers.test.ts
Linked repository file from this build.
import { expect, test } from "bun:test";
import { buildMailedDocument, formatAppointmentEastern } from "./search.helpers";
test("appointment display preserves Eastern wall time without browser timezone conversion", () => {
expect(formatAppointmentEastern("")).toBe("No appointment scheduled");
expect(formatAppointmentEastern("2026-05-10T14:30")).toBe("May 10, 2026 at 2:30 PM Eastern");
expect(formatAppointmentEastern("2026-05-10T00:15")).toBe("May 10, 2026 at 12:15 AM Eastern");
expect(formatAppointmentEastern("2026-05-10T12:00")).toBe("May 10, 2026 at 12:00 PM Eastern");
});
test("incoming mail keeps its storage reference and trimmed details", () => {
const file = new File(["%PDF-1.4"], "incoming.pdf", { type: "application/pdf" });
const document = buildMailedDocument(file, "mail-key", {
name: " Incoming notice ",
description: " Explains the denial date. ",
});
expect(document.storageKey).toBe("mail-key");
expect(document.description).toBe("Explains the denial date.");
expect(document.name).toBe("Incoming notice");
expect(() => buildMailedDocument(file, "mail-key", { name: "Notice", description: " " })).toThrow(
"purpose",
);
expect(document.filename).toBe(file.name);
expect(document.size).toBe(file.size);
});