fix: tighten shared chat envelope coverage
This commit is contained in:
@@ -14,6 +14,7 @@ describe("shared/chat-envelope", () => {
|
||||
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");
|
||||
expect(stripEnvelope("[Teams] hello")).toBe("[Teams] hello");
|
||||
});
|
||||
|
||||
it("removes standalone message id hint lines but keeps inline mentions", () => {
|
||||
@@ -21,6 +22,7 @@ describe("shared/chat-envelope", () => {
|
||||
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("hello\r\n[MESSAGE_ID: abc123]\r\nworld")).toBe("hello\nworld");
|
||||
expect(stripMessageIdHints("I typed [message_id: abc123] inline")).toBe(
|
||||
"I typed [message_id: abc123] inline",
|
||||
);
|
||||
|
||||
@@ -39,7 +39,7 @@ export function stripEnvelope(text: string): string {
|
||||
}
|
||||
|
||||
export function stripMessageIdHints(text: string): string {
|
||||
if (!text.includes("[message_id:")) {
|
||||
if (!/\[message_id:/i.test(text)) {
|
||||
return text;
|
||||
}
|
||||
const lines = text.split(/\r?\n/);
|
||||
|
||||
Reference in New Issue
Block a user