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>
27 lines
833 B
TypeScript
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 & Jerry 'hello'")).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()
|
|
})
|
|
})
|