mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 03:10:21 +00:00
perf(test): fake abort timer and dedupe slack thread cases
This commit is contained in:
@@ -61,29 +61,22 @@ describe("resolveSlackThreadTs", () => {
|
||||
const threadTs = "1234567890.123456";
|
||||
const messageTs = "9999999999.999999";
|
||||
|
||||
it("stays in incoming threads for all replyToMode values", () => {
|
||||
for (const replyToMode of ["off", "first", "all"] as const) {
|
||||
for (const hasReplied of [false, true]) {
|
||||
expect(
|
||||
resolveSlackThreadTs({
|
||||
replyToMode,
|
||||
incomingThreadTs: threadTs,
|
||||
messageTs,
|
||||
hasReplied,
|
||||
}),
|
||||
).toBe(threadTs);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
describe("replyToMode=off", () => {
|
||||
it("returns incomingThreadTs when in a thread", () => {
|
||||
expect(
|
||||
resolveSlackThreadTs({
|
||||
replyToMode: "off",
|
||||
incomingThreadTs: threadTs,
|
||||
messageTs,
|
||||
hasReplied: false,
|
||||
}),
|
||||
).toBe(threadTs);
|
||||
});
|
||||
|
||||
it("returns incomingThreadTs even after replies (stays in thread)", () => {
|
||||
expect(
|
||||
resolveSlackThreadTs({
|
||||
replyToMode: "off",
|
||||
incomingThreadTs: threadTs,
|
||||
messageTs,
|
||||
hasReplied: true,
|
||||
}),
|
||||
).toBe(threadTs);
|
||||
});
|
||||
|
||||
it("returns undefined when not in a thread", () => {
|
||||
expect(
|
||||
resolveSlackThreadTs({
|
||||
@@ -97,17 +90,6 @@ describe("resolveSlackThreadTs", () => {
|
||||
});
|
||||
|
||||
describe("replyToMode=first", () => {
|
||||
it("returns incomingThreadTs when in a thread (always stays threaded)", () => {
|
||||
expect(
|
||||
resolveSlackThreadTs({
|
||||
replyToMode: "first",
|
||||
incomingThreadTs: threadTs,
|
||||
messageTs,
|
||||
hasReplied: false,
|
||||
}),
|
||||
).toBe(threadTs);
|
||||
});
|
||||
|
||||
it("returns messageTs for first reply when not in a thread", () => {
|
||||
expect(
|
||||
resolveSlackThreadTs({
|
||||
@@ -132,17 +114,6 @@ describe("resolveSlackThreadTs", () => {
|
||||
});
|
||||
|
||||
describe("replyToMode=all", () => {
|
||||
it("returns incomingThreadTs when in a thread", () => {
|
||||
expect(
|
||||
resolveSlackThreadTs({
|
||||
replyToMode: "all",
|
||||
incomingThreadTs: threadTs,
|
||||
messageTs,
|
||||
hasReplied: false,
|
||||
}),
|
||||
).toBe(threadTs);
|
||||
});
|
||||
|
||||
it("returns messageTs when not in a thread (starts thread)", () => {
|
||||
expect(
|
||||
resolveSlackThreadTs({
|
||||
|
||||
Reference in New Issue
Block a user