
























@@ -5,6 +5,8 @@ import { registerModelsCli } from "./models-cli.js";
5566const mocks = vi.hoisted(() => ({
77modelsStatusCommand: vi.fn().mockResolvedValue(undefined),
8+modelsSetCommand: vi.fn().mockResolvedValue(undefined),
9+modelsSetImageCommand: vi.fn().mockResolvedValue(undefined),
810noopAsync: vi.fn(async () => undefined),
911modelsAuthAddCommand: vi.fn().mockResolvedValue(undefined),
1012modelsAuthLoginCommand: vi.fn().mockResolvedValue(undefined),
@@ -17,6 +19,8 @@ const {
1719 modelsAuthLoginCommand,
1820 modelsAuthPasteTokenCommand,
1921 modelsAuthSetupTokenCommand,
22+ modelsSetCommand,
23+ modelsSetImageCommand,
2024 modelsStatusCommand,
2125} = mocks;
2226@@ -58,10 +62,10 @@ vi.mock("../commands/models/scan.js", () => ({
5862modelsScanCommand: mocks.noopAsync,
5963}));
6064vi.mock("../commands/models/set.js", () => ({
61-modelsSetCommand: mocks.noopAsync,
65+modelsSetCommand: mocks.modelsSetCommand,
6266}));
6367vi.mock("../commands/models/set-image.js", () => ({
64-modelsSetImageCommand: mocks.noopAsync,
68+modelsSetImageCommand: mocks.modelsSetImageCommand,
6569}));
66706771describe("models cli", () => {
@@ -70,6 +74,8 @@ describe("models cli", () => {
7074modelsAuthLoginCommand.mockClear();
7175modelsAuthPasteTokenCommand.mockClear();
7276modelsAuthSetupTokenCommand.mockClear();
77+modelsSetCommand.mockClear();
78+modelsSetImageCommand.mockClear();
7379modelsStatusCommand.mockClear();
7480});
7581@@ -162,6 +168,23 @@ describe("models cli", () => {
162168expect(command).toHaveBeenCalledWith(expect.objectContaining(expected), expect.any(Object));
163169});
164170171+it.each([
172+{
173+label: "set",
174+args: ["models", "--agent", "poe", "set", "anthropic/claude-sonnet-4-6"],
175+command: modelsSetCommand,
176+},
177+{
178+label: "set-image",
179+args: ["models", "--agent", "poe", "set-image", "openai/gpt-image-1"],
180+command: modelsSetImageCommand,
181+},
182+])("rejects parent --agent for models $label", async ({ args, command }) => {
183+await expect(runModelsCommand(args)).rejects.toThrow("does not support `--agent`");
184+185+expect(command).not.toHaveBeenCalled();
186+});
187+165188it("shows help for models auth without error exit", async () => {
166189const program = new Command();
167190program.exitOverride();
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。