fix: strip markup heartbeat acks

This commit is contained in:
Peter Steinberger
2026-01-11 23:26:51 +00:00
parent 5462cfdc3a
commit 4181e72977
4 changed files with 130 additions and 7 deletions

View File

@@ -90,4 +90,36 @@ describe("stripHeartbeatToken", () => {
didStrip: false,
});
});
it("strips HTML-wrapped heartbeat tokens", () => {
expect(
stripHeartbeatToken(`<b>${HEARTBEAT_TOKEN}</b>`, { mode: "heartbeat" }),
).toEqual({
shouldSkip: true,
text: "",
didStrip: true,
});
});
it("strips markdown-wrapped heartbeat tokens", () => {
expect(
stripHeartbeatToken(`**${HEARTBEAT_TOKEN}**`, { mode: "heartbeat" }),
).toEqual({
shouldSkip: true,
text: "",
didStrip: true,
});
});
it("removes markup-wrapped token and keeps trailing content", () => {
expect(
stripHeartbeatToken(`<code>${HEARTBEAT_TOKEN}</code> all good`, {
mode: "message",
}),
).toEqual({
shouldSkip: false,
text: "all good",
didStrip: true,
});
});
});