mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-05 13:41:42 +00:00
* refactor(plugins): trim activation and contract exports * test(plugins): restore fixture cleanup * refactor(plugins): trim install and loader exports * test(plugins): fully reset loader caches * refactor(plugins): trim metadata and catalog exports * test(plugins): preserve catalog trust coverage * refactor(plugins): trim provider and plugin exports * refactor(plugins): trim runtime and tool exports * test(plugins): update dead-export consumers * test(plugins): remove empty dead-export suites * refactor(plugins): align exports with split registry * refactor(plugins): trim drifted loader exports * style(plugins): format test fixtures * refactor(scripts): use supported plugin APIs * refactor(plugins): finish dead export cleanup * chore(deadcode): refresh export baseline * test(cli): mock production memory state * chore(deadcode): sync latest export baseline * fix(tests): keep plugin fixtures inside core * chore(deadcode): refresh rebased export baseline * chore(deadcode): sync current ratchets * fix(plugins): retain reserved slot invariant * fix(plugins): preserve dead-export invariants * test(plugins): use neutral catalog query fixture * test(plugins): satisfy catalog lint * test(plugins): preserve integrity drift coverage * fix(ci): register skill experience live proof
51 lines
1.8 KiB
TypeScript
51 lines
1.8 KiB
TypeScript
// Covers provider auth choice selection for plugin-owned providers.
|
|
import { describe, expect, it, vi } from "vitest";
|
|
import { createWizardPrompter } from "../../test/helpers/wizard-prompter.js";
|
|
import { createNonExitingRuntime } from "../runtime.js";
|
|
import type { ProviderPlugin } from "./types.js";
|
|
|
|
const ensureCodexRuntimePluginForModelSelection = vi.hoisted(() => vi.fn());
|
|
vi.mock("../commands/codex-runtime-plugin-install.js", () => ({
|
|
CODEX_RUNTIME_PLUGIN_ID: "codex",
|
|
ensureCodexRuntimePluginForModelSelection,
|
|
}));
|
|
|
|
const ensureCopilotRuntimePluginForModelSelection = vi.hoisted(() => vi.fn());
|
|
vi.mock("../commands/copilot-runtime-plugin-install.js", () => ({
|
|
ensureCopilotRuntimePluginForModelSelection,
|
|
}));
|
|
|
|
const offerPostInstallMigrations = vi.hoisted(() => vi.fn());
|
|
vi.mock("../wizard/setup.post-install-migration.js", () => ({
|
|
offerPostInstallMigrations,
|
|
}));
|
|
|
|
const { runProviderPluginAuthMethodUnpersisted } = await import("./provider-auth-choice.js");
|
|
|
|
describe("runProviderPluginAuthMethodUnpersisted", () => {
|
|
it("delegates remote browser destinations to structured wizard clients", async () => {
|
|
const openUrl = vi.fn(async () => undefined);
|
|
const method: ProviderPlugin["auth"][number] = {
|
|
id: "oauth",
|
|
label: "OAuth",
|
|
kind: "oauth",
|
|
run: async (ctx) => {
|
|
await ctx.openUrl("https://provider.example/oauth?state=state-1");
|
|
return { profiles: [] };
|
|
},
|
|
};
|
|
|
|
await runProviderPluginAuthMethodUnpersisted({
|
|
config: {},
|
|
runtime: createNonExitingRuntime(),
|
|
isRemote: true,
|
|
prompter: { ...createWizardPrompter(), openUrl },
|
|
method,
|
|
agentDir: "/tmp/agent",
|
|
workspaceDir: "/tmp/workspace",
|
|
});
|
|
|
|
expect(openUrl).toHaveBeenCalledWith("https://provider.example/oauth?state=state-1");
|
|
});
|
|
});
|