test: trim plugin + telegram test setup
This commit is contained in:
@@ -98,8 +98,34 @@ describe("loadClawdbotPlugins", () => {
|
|||||||
expect(enabled?.status).toBe("loaded");
|
expect(enabled?.status).toBe("loaded");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("loads bundled telegram plugin when enabled", { timeout: 120_000 }, () => {
|
it("loads bundled telegram plugin when enabled", () => {
|
||||||
process.env.CLAWDBOT_BUNDLED_PLUGINS_DIR = path.join(process.cwd(), "extensions");
|
const bundledDir = makeTempDir();
|
||||||
|
writePlugin({
|
||||||
|
id: "telegram",
|
||||||
|
body: `export default { id: "telegram", register(api) {
|
||||||
|
api.registerChannel({
|
||||||
|
plugin: {
|
||||||
|
id: "telegram",
|
||||||
|
meta: {
|
||||||
|
id: "telegram",
|
||||||
|
label: "Telegram",
|
||||||
|
selectionLabel: "Telegram",
|
||||||
|
docsPath: "/channels/telegram",
|
||||||
|
blurb: "telegram channel"
|
||||||
|
},
|
||||||
|
capabilities: { chatTypes: ["direct"] },
|
||||||
|
config: {
|
||||||
|
listAccountIds: () => [],
|
||||||
|
resolveAccount: () => ({ accountId: "default" })
|
||||||
|
},
|
||||||
|
outbound: { deliveryMode: "direct" }
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} };`,
|
||||||
|
dir: bundledDir,
|
||||||
|
filename: "telegram.ts",
|
||||||
|
});
|
||||||
|
process.env.CLAWDBOT_BUNDLED_PLUGINS_DIR = bundledDir;
|
||||||
|
|
||||||
const registry = loadClawdbotPlugins({
|
const registry = loadClawdbotPlugins({
|
||||||
cache: false,
|
cache: false,
|
||||||
|
|||||||
@@ -6,7 +6,12 @@ import {
|
|||||||
listNativeCommandSpecs,
|
listNativeCommandSpecs,
|
||||||
listNativeCommandSpecsForConfig,
|
listNativeCommandSpecsForConfig,
|
||||||
} from "../auto-reply/commands-registry.js";
|
} from "../auto-reply/commands-registry.js";
|
||||||
import { listSkillCommandsForAgents } from "../auto-reply/skill-commands.js";
|
const { listSkillCommandsForAgents } = vi.hoisted(() => ({
|
||||||
|
listSkillCommandsForAgents: vi.fn(() => []),
|
||||||
|
}));
|
||||||
|
vi.mock("../auto-reply/skill-commands.js", () => ({
|
||||||
|
listSkillCommandsForAgents,
|
||||||
|
}));
|
||||||
import { resetInboundDedupe } from "../auto-reply/reply/inbound-dedupe.js";
|
import { resetInboundDedupe } from "../auto-reply/reply/inbound-dedupe.js";
|
||||||
import * as replyModule from "../auto-reply/reply.js";
|
import * as replyModule from "../auto-reply/reply.js";
|
||||||
import { expectInboundContextContract } from "../../test/helpers/inbound-contract.js";
|
import { expectInboundContextContract } from "../../test/helpers/inbound-contract.js";
|
||||||
|
|||||||
Reference in New Issue
Block a user