evOo-local/apps/mobile/lib/preview.test.ts
cynarAI 6c7eed7580 Initial clean evOo-local from f00577b
Fresh history cut from cynarAI/evoo antigravity-handoff/project-timeline
(Voice First + project timeline). Brand docs/titles as evOo; keep @rakazo/*
packages as tech debt. Excludes node_modules, caches, secrets, voice blobs.
2026-09-20 17:15:16 +02:00

37 lines
1.2 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { previewSnippet } from "./preview.js";
describe("previewSnippet", () => {
it("keeps a short last message as a single plain line", () => {
expect(previewSnippet("venue booked, contract sent")).toBe("venue booked, contract sent");
});
it("strips markdown and collapses a long last message to the first words", () => {
const lastMessage = [
"Done! ✅",
"",
"The inbox is **completely empty** and those drafts were **permanently deleted**.",
"",
"- 🗓️ **alex@example.com**",
"- follow-up parked",
"",
"No data was lost.",
].join("\n");
expect(previewSnippet(lastMessage)).toBe(
"Done! ✅ The inbox is completely empty and those drafts were permanently",
);
});
it("turns links, lists, and headings into readable words", () => {
expect(previewSnippet("# Status\n- see [the report](https://example.com)")).toBe(
"Status see the report",
);
});
it("returns an empty snippet when there is no message text", () => {
expect(previewSnippet("")).toBe("");
expect(previewSnippet(" ** ** ")).toBe("");
});
});