
























@@ -1,5 +1,9 @@
11import { describe, expect, it } from "vitest";
22import { createSlackSendTestClient, installSlackBlockTestMocks } from "./blocks.test-helpers.js";
3+import {
4+clearSlackThreadParticipationCache,
5+hasSlackThreadParticipation,
6+} from "./sent-thread-cache.js";
3748installSlackBlockTestMocks();
59const { sendMessageSlack } = await import("./send.js");
@@ -67,6 +71,49 @@ describe("sendMessageSlack NO_REPLY guard", () => {
6771});
6872});
697374+describe("sendMessageSlack thread participation", () => {
75+it("records participation after a successful threaded send", async () => {
76+clearSlackThreadParticipationCache();
77+const client = createSlackSendTestClient();
78+79+await sendMessageSlack("channel:C123", "hello thread", {
80+token: "xoxb-test",
81+cfg: SLACK_TEST_CFG,
82+ client,
83+threadTs: "1712345678.123456",
84+});
85+86+expect(hasSlackThreadParticipation("default", "C123", "1712345678.123456")).toBe(true);
87+});
88+89+it("does not record participation for unthreaded sends", async () => {
90+clearSlackThreadParticipationCache();
91+const client = createSlackSendTestClient();
92+93+await sendMessageSlack("channel:C123", "hello channel", {
94+token: "xoxb-test",
95+cfg: SLACK_TEST_CFG,
96+ client,
97+});
98+99+expect(hasSlackThreadParticipation("default", "C123", "1712345678.123456")).toBe(false);
100+});
101+102+it("does not record participation for invalid thread ids", async () => {
103+clearSlackThreadParticipationCache();
104+const client = createSlackSendTestClient();
105+106+await sendMessageSlack("channel:C123", "hello invalid thread", {
107+token: "xoxb-test",
108+cfg: SLACK_TEST_CFG,
109+ client,
110+threadTs: "not-a-slack-thread",
111+});
112+113+expect(hasSlackThreadParticipation("default", "C123", "not-a-slack-thread")).toBe(false);
114+});
115+});
116+70117describe("sendMessageSlack chunking", () => {
71118it("keeps 4205-character text in a single Slack post by default", async () => {
72119const client = createSlackSendTestClient();
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。