Files
openclaw-zero-token/commands/channels.plugin-install.test-helpers.ts
sjhu 571e14a236 feat: upgrade to upstream v2026.3.28
Major upgrade from e26988a38 to upstream v2026.3.28 (f9b107928).
Key changes:
- Upstream src/, ui/, extensions/ (89 bundled extensions)
- Zero-token web providers preserved in src/zero-token/
- AskOnce plugin restored and registered as CLI command
- Added missing packages: @anthropic-ai/vertex-sdk, @modelcontextprotocol/sdk
- Fixed tsconfig rootDir, skipLibCheck for plugin-sdk DTS build
- Added askonce to bundled plugin metadata and package.json exports
- Fixed AskOnce CLI command registration (missing commands metadata)
- Restored AskOnce adapter imports (correct 5-level relative paths)
- Removed stale migration artifacts from root directory
2026-03-30 17:58:12 +08:00

80 lines
2.2 KiB
TypeScript

import { vi } from "vitest";
import type { ChannelPluginCatalogEntry } from "../channels/plugins/catalog.js";
import type { ChannelPlugin } from "../channels/plugins/types.js";
import { createChannelTestPluginBase, createTestRegistry } from "../test-utils/channel-plugins.js";
export function createMockChannelSetupPluginInstallModule(
actual: typeof import("./channel-setup/plugin-install.js"),
) {
return {
...actual,
ensureChannelSetupPluginInstalled: vi.fn(async ({ cfg }) => ({ cfg, installed: true })),
loadChannelSetupPluginRegistrySnapshotForChannel: vi.fn(() => createTestRegistry()),
};
}
export function createMSTeamsCatalogEntry(): ChannelPluginCatalogEntry {
return {
id: "msteams",
pluginId: "@openclaw/msteams-plugin",
meta: {
id: "msteams",
label: "Microsoft Teams",
selectionLabel: "Microsoft Teams",
docsPath: "/channels/msteams",
blurb: "teams channel",
},
install: {
npmSpec: "@openclaw/msteams",
},
};
}
export function createMSTeamsSetupPlugin(): ChannelPlugin {
return {
...createChannelTestPluginBase({
id: "msteams",
label: "Microsoft Teams",
docsPath: "/channels/msteams",
}),
setup: {
applyAccountConfig: vi.fn(({ cfg, input }) => ({
...cfg,
channels: {
...cfg.channels,
msteams: {
enabled: true,
tenantId: input.token,
},
},
})),
},
} as ChannelPlugin;
}
export function createMSTeamsDeletePlugin(): ChannelPlugin {
return {
...createChannelTestPluginBase({
id: "msteams",
label: "Microsoft Teams",
docsPath: "/channels/msteams",
}),
config: {
...createChannelTestPluginBase({
id: "msteams",
label: "Microsoft Teams",
docsPath: "/channels/msteams",
}).config,
deleteAccount: vi.fn(({ cfg }: { cfg: Record<string, unknown> }) => {
const channels = (cfg.channels as Record<string, unknown> | undefined) ?? {};
const nextChannels = { ...channels };
delete nextChannels.msteams;
return {
...cfg,
channels: nextChannels,
};
}),
},
};
}