mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-20 05:31:30 +00:00
refactor(plugins): simplify provider auth choice metadata
This commit is contained in:
@@ -2,18 +2,17 @@ import { Command } from "commander";
|
||||
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { runRegisteredCli } from "../test-utils/command-runner.js";
|
||||
|
||||
const githubCopilotLoginCommand = vi.fn();
|
||||
const modelsStatusCommand = vi.fn().mockResolvedValue(undefined);
|
||||
const noopAsync = vi.fn(async () => undefined);
|
||||
const modelsAuthLoginCommand = vi.fn().mockResolvedValue(undefined);
|
||||
|
||||
vi.mock("../commands/models.js", () => ({
|
||||
githubCopilotLoginCommand,
|
||||
modelsStatusCommand,
|
||||
modelsAliasesAddCommand: noopAsync,
|
||||
modelsAliasesListCommand: noopAsync,
|
||||
modelsAliasesRemoveCommand: noopAsync,
|
||||
modelsAuthAddCommand: noopAsync,
|
||||
modelsAuthLoginCommand: noopAsync,
|
||||
modelsAuthLoginCommand,
|
||||
modelsAuthOrderClearCommand: noopAsync,
|
||||
modelsAuthOrderGetCommand: noopAsync,
|
||||
modelsAuthOrderSetCommand: noopAsync,
|
||||
@@ -42,7 +41,7 @@ describe("models cli", () => {
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
githubCopilotLoginCommand.mockClear();
|
||||
modelsAuthLoginCommand.mockClear();
|
||||
modelsStatusCommand.mockClear();
|
||||
});
|
||||
|
||||
@@ -74,9 +73,13 @@ describe("models cli", () => {
|
||||
from: "user",
|
||||
});
|
||||
|
||||
expect(githubCopilotLoginCommand).toHaveBeenCalledTimes(1);
|
||||
expect(githubCopilotLoginCommand).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ yes: true }),
|
||||
expect(modelsAuthLoginCommand).toHaveBeenCalledTimes(1);
|
||||
expect(modelsAuthLoginCommand).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
provider: "github-copilot",
|
||||
method: "device",
|
||||
yes: true,
|
||||
}),
|
||||
expect.any(Object),
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user