mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-20 14:30:57 +00:00
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)
32 lines
985 B
TypeScript
32 lines
985 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { buildSlackBlocksFallbackText } from "./blocks-fallback.js";
|
|
|
|
describe("buildSlackBlocksFallbackText", () => {
|
|
it("prefers header text", () => {
|
|
expect(
|
|
buildSlackBlocksFallbackText([
|
|
{ type: "header", text: { type: "plain_text", text: "Deploy status" } },
|
|
] as never),
|
|
).toBe("Deploy status");
|
|
});
|
|
|
|
it("uses image alt text", () => {
|
|
expect(
|
|
buildSlackBlocksFallbackText([
|
|
{ type: "image", image_url: "https://example.com/image.png", alt_text: "Latency chart" },
|
|
] as never),
|
|
).toBe("Latency chart");
|
|
});
|
|
|
|
it("uses generic defaults for file and unknown blocks", () => {
|
|
expect(
|
|
buildSlackBlocksFallbackText([
|
|
{ type: "file", source: "remote", external_id: "F123" },
|
|
] as never),
|
|
).toBe("Shared a file");
|
|
expect(buildSlackBlocksFallbackText([{ type: "divider" }] as never)).toBe(
|
|
"Shared a Block Kit message",
|
|
);
|
|
});
|
|
});
|