mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-21 10:16:44 +00:00
fix: keep channel CLI helpers private
This commit is contained in:
@@ -3,7 +3,7 @@ import { Command } from "commander";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import type { PluginPackageChannel } from "../plugins/manifest.js";
|
||||
import { mockProcessPlatform } from "../test-utils/vitest-spies.js";
|
||||
import { registerChannelsCli, resolveChannelsAddOptions } from "./channels-cli.js";
|
||||
import { registerChannelsCli } from "./channels-cli.js";
|
||||
|
||||
const listBundledPackageChannelMetadataMock = vi.hoisted(() =>
|
||||
vi.fn<() => readonly PluginPackageChannel[]>(() => []),
|
||||
@@ -106,23 +106,3 @@ describe("registerChannelsCli", () => {
|
||||
expect(getChannelAddOptionFlags(program)).toContain("--homeserver <url>");
|
||||
});
|
||||
});
|
||||
|
||||
describe("resolveChannelsAddOptions", () => {
|
||||
it("accepts a positional channel while preserving --channel precedence", () => {
|
||||
expect(
|
||||
resolveChannelsAddOptions("clickclack", {
|
||||
baseUrl: "https://clickclack.example",
|
||||
token: "ccb_test",
|
||||
workspace: "default",
|
||||
}),
|
||||
).toEqual({
|
||||
channel: "clickclack",
|
||||
baseUrl: "https://clickclack.example",
|
||||
token: "ccb_test",
|
||||
workspace: "default",
|
||||
});
|
||||
expect(resolveChannelsAddOptions("clickclack", { channel: "telegram" })).toEqual({
|
||||
channel: "telegram",
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -51,7 +51,7 @@ function getOptionNames(command: Command): string[] {
|
||||
return command.options.map((option) => option.attributeName());
|
||||
}
|
||||
|
||||
export function resolveChannelsAddOptions(
|
||||
function resolveChannelsAddOptions(
|
||||
channelArg: string | undefined,
|
||||
opts: Record<string, unknown>,
|
||||
): Record<string, unknown> {
|
||||
|
||||
Reference in New Issue
Block a user