test: tighten directive tag assertions

This commit is contained in:
Peter Steinberger
2026-05-09 12:53:44 +01:00
parent 91adcc68fe
commit 974fdc6bc0

View File

@@ -216,9 +216,10 @@ describe("stripInlineDirectiveTagsFromMessageForDisplay", () => {
content: [{ type: "text", text: "hello [[reply_to_current]] world [[audio_as_voice]]" }],
};
const result = stripInlineDirectiveTagsFromMessageForDisplay(input);
expect(result).toMatchObject({
content: [{ type: "text", text: "hello world " }],
});
if (!result) {
throw new Error("expected stripped message");
}
expect(result.content).toEqual([{ type: "text", text: "hello world " }]);
});
test("preserves empty-string text when directives are entire content", () => {
@@ -227,9 +228,10 @@ describe("stripInlineDirectiveTagsFromMessageForDisplay", () => {
content: [{ type: "text", text: "[[reply_to_current]]" }],
};
const result = stripInlineDirectiveTagsFromMessageForDisplay(input);
expect(result).toMatchObject({
content: [{ type: "text", text: "" }],
});
if (!result) {
throw new Error("expected stripped message");
}
expect(result.content).toEqual([{ type: "text", text: "" }]);
});
test("returns original message when content is not an array", () => {