From 80569babd3a33bf69b57d19a10dae6e9acf598b8 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 13 Mar 2026 21:37:10 +0000 Subject: [PATCH] test: tighten shared chat envelope coverage --- src/shared/chat-envelope.test.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/shared/chat-envelope.test.ts b/src/shared/chat-envelope.test.ts index d04bc014e44..0bd513c1b61 100644 --- a/src/shared/chat-envelope.test.ts +++ b/src/shared/chat-envelope.test.ts @@ -4,18 +4,23 @@ import { stripEnvelope, stripMessageIdHints } from "./chat-envelope.js"; describe("shared/chat-envelope", () => { it("strips recognized channel and timestamp envelope prefixes only", () => { expect(stripEnvelope("[WhatsApp 2026-01-24 13:36] hello")).toBe("hello"); + expect(stripEnvelope("[Google Chat room] hello")).toBe("hello"); expect(stripEnvelope("[2026-01-24T13:36Z] hello")).toBe("hello"); + expect(stripEnvelope("[2026-01-24 13:36] hello")).toBe("hello"); expect(stripEnvelope("[Custom Sender] hello")).toBe("[Custom Sender] hello"); }); it("keeps non-envelope headers and preserves unmatched text", () => { expect(stripEnvelope("hello")).toBe("hello"); expect(stripEnvelope("[note] hello")).toBe("[note] hello"); + expect(stripEnvelope("[2026/01/24 13:36] hello")).toBe("[2026/01/24 13:36] hello"); }); it("removes standalone message id hint lines but keeps inline mentions", () => { expect(stripMessageIdHints("hello\n[message_id: abc123]")).toBe("hello"); expect(stripMessageIdHints("hello\n [message_id: abc123] \nworld")).toBe("hello\nworld"); + expect(stripMessageIdHints("[message_id: abc123]\nhello")).toBe("hello"); + expect(stripMessageIdHints("[message_id: abc123]")).toBe(""); expect(stripMessageIdHints("I typed [message_id: abc123] inline")).toBe( "I typed [message_id: abc123] inline", );