JUNOHUB-test/src/lib/tickets/emailLogTickets.test.ts
Saad Mohsin 6cc4472feb Harden upsell reliability and ticket context completeness.
Add strict linked-product upsell controls, improve retrieval consistency, persist full storefront escalation transcripts, and upgrade ticket APIs/UI for complete thread visibility and safer human handoff workflows.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-13 23:45:47 +05:00

27 lines
833 B
TypeScript

import { describe, expect, it } from "vitest"
import {
decodeHtmlEntities,
normalizeSubject,
parseTicketId,
} from "@/lib/tickets/emailLogTickets"
describe("emailLog ticket helpers", () => {
it("normalizes nested reply prefixes", () => {
expect(normalizeSubject("Re: Fwd: re: Shipping delay")).toBe("Shipping delay")
})
it("decodes html entities in previews", () => {
expect(decodeHtmlEntities("Tom &amp; Jerry &#39;hello&#39;")).toBe(
"Tom & Jerry 'hello'",
)
})
it("parses ticket id into email and root subject", () => {
expect(parseTicketId("customer@example.com::Order 1002")).toEqual({
customerEmail: "customer@example.com",
rootSubject: "Order 1002",
})
expect(parseTicketId("invalid")).toBeNull()
})
})