mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 05:39:35 +00:00
feat (cli): add account selector for pairing commands
This commit is contained in:
@@ -94,6 +94,20 @@ describe("pairing cli", () => {
|
||||
expect(listChannelPairingRequests).toHaveBeenCalledWith("telegram");
|
||||
});
|
||||
|
||||
it("forwards --account for list", async () => {
|
||||
const { registerPairingCli } = await import("./pairing-cli.js");
|
||||
listChannelPairingRequests.mockResolvedValueOnce([]);
|
||||
|
||||
const program = new Command();
|
||||
program.name("test");
|
||||
registerPairingCli(program);
|
||||
await program.parseAsync(["pairing", "list", "--channel", "telegram", "--account", "yy"], {
|
||||
from: "user",
|
||||
});
|
||||
|
||||
expect(listChannelPairingRequests).toHaveBeenCalledWith("telegram", process.env, "yy");
|
||||
});
|
||||
|
||||
it("normalizes channel aliases", async () => {
|
||||
const { registerPairingCli } = await import("./pairing-cli.js");
|
||||
listChannelPairingRequests.mockResolvedValueOnce([]);
|
||||
@@ -170,4 +184,33 @@ describe("pairing cli", () => {
|
||||
});
|
||||
expect(log).toHaveBeenCalledWith(expect.stringContaining("Approved"));
|
||||
});
|
||||
|
||||
it("forwards --account for approve", async () => {
|
||||
const { registerPairingCli } = await import("./pairing-cli.js");
|
||||
approveChannelPairingCode.mockResolvedValueOnce({
|
||||
id: "123",
|
||||
entry: {
|
||||
id: "123",
|
||||
code: "ABCDEFGH",
|
||||
createdAt: "2026-01-08T00:00:00Z",
|
||||
lastSeenAt: "2026-01-08T00:00:00Z",
|
||||
},
|
||||
});
|
||||
|
||||
const program = new Command();
|
||||
program.name("test");
|
||||
registerPairingCli(program);
|
||||
await program.parseAsync(
|
||||
["pairing", "approve", "--channel", "telegram", "--account", "yy", "ABCDEFGH"],
|
||||
{
|
||||
from: "user",
|
||||
},
|
||||
);
|
||||
|
||||
expect(approveChannelPairingCode).toHaveBeenCalledWith({
|
||||
channel: "telegram",
|
||||
code: "ABCDEFGH",
|
||||
accountId: "yy",
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user