mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-29 19:01:44 +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)
43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
import { describe, expect, it, vi } from "vitest";
|
|
import { resolveSlackChannelAllowlist } from "./resolve-channels.js";
|
|
|
|
describe("resolveSlackChannelAllowlist", () => {
|
|
it("resolves by name and prefers active channels", async () => {
|
|
const client = {
|
|
conversations: {
|
|
list: vi.fn().mockResolvedValue({
|
|
channels: [
|
|
{ id: "C1", name: "general", is_archived: true },
|
|
{ id: "C2", name: "general", is_archived: false },
|
|
],
|
|
}),
|
|
},
|
|
};
|
|
|
|
const res = await resolveSlackChannelAllowlist({
|
|
token: "xoxb-test",
|
|
entries: ["#general"],
|
|
client: client as never,
|
|
});
|
|
|
|
expect(res[0]?.resolved).toBe(true);
|
|
expect(res[0]?.id).toBe("C2");
|
|
});
|
|
|
|
it("keeps unresolved entries", async () => {
|
|
const client = {
|
|
conversations: {
|
|
list: vi.fn().mockResolvedValue({ channels: [] }),
|
|
},
|
|
};
|
|
|
|
const res = await resolveSlackChannelAllowlist({
|
|
token: "xoxb-test",
|
|
entries: ["#does-not-exist"],
|
|
client: client as never,
|
|
});
|
|
|
|
expect(res[0]?.resolved).toBe(false);
|
|
});
|
|
});
|