openclaw/extensions/slack/src/monitor/message-handler/dispatch.streaming.test.ts
scoootscooob 8746362f5e
refactor(slack): move Slack channel code to extensions/slack/src/ (#45621)
Move all Slack channel implementation files from src/slack/ to
extensions/slack/src/ and replace originals with shim re-exports.
This follows the extension migration pattern for channel plugins.

- Copy all .ts files to extensions/slack/src/ (preserving directory
  structure: monitor/, http/, monitor/events/, monitor/message-handler/)
- Transform import paths: external src/ imports use relative paths
  back to src/, internal slack imports stay relative within extension
- Replace all src/slack/ files with shim re-exports pointing to
  the extension copies
- Update tsconfig.plugin-sdk.dts.json rootDir from "src" to "." so
  the DTS build can follow shim chains into extensions/
- Update write-plugin-sdk-entry-dts.ts re-export path accordingly
- Preserve extensions/slack/index.ts, package.json, openclaw.plugin.json,
  src/channel.ts, src/runtime.ts, src/channel.test.ts (untouched)
2026-03-14 02:47:04 -07:00

48 lines
1.6 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { isSlackStreamingEnabled, resolveSlackStreamingThreadHint } from "./dispatch.js";
describe("slack native streaming defaults", () => {
it("is enabled for partial mode when native streaming is on", () => {
expect(isSlackStreamingEnabled({ mode: "partial", nativeStreaming: true })).toBe(true);
});
it("is disabled outside partial mode or when native streaming is off", () => {
expect(isSlackStreamingEnabled({ mode: "partial", nativeStreaming: false })).toBe(false);
expect(isSlackStreamingEnabled({ mode: "block", nativeStreaming: true })).toBe(false);
expect(isSlackStreamingEnabled({ mode: "progress", nativeStreaming: true })).toBe(false);
expect(isSlackStreamingEnabled({ mode: "off", nativeStreaming: true })).toBe(false);
});
});
describe("slack native streaming thread hint", () => {
it("stays off-thread when replyToMode=off and message is not in a thread", () => {
expect(
resolveSlackStreamingThreadHint({
replyToMode: "off",
incomingThreadTs: undefined,
messageTs: "1000.1",
}),
).toBeUndefined();
});
it("uses first-reply thread when replyToMode=first", () => {
expect(
resolveSlackStreamingThreadHint({
replyToMode: "first",
incomingThreadTs: undefined,
messageTs: "1000.2",
}),
).toBe("1000.2");
});
it("uses the existing incoming thread regardless of replyToMode", () => {
expect(
resolveSlackStreamingThreadHint({
replyToMode: "off",
incomingThreadTs: "2000.1",
messageTs: "1000.3",
}),
).toBe("2000.1");
});
});