test: inject provider auth command fixtures

This commit is contained in:
Peter Steinberger
2026-04-10 16:41:10 +01:00
parent d6ece7fb89
commit 8a5b7cf573
3 changed files with 135 additions and 99 deletions

View File

@@ -78,10 +78,31 @@ function restoreConfiguredPrimaryModel(
};
}
type ProviderAuthChoiceRuntime = typeof import("./provider-auth-choice.runtime.js");
const defaultProviderAuthChoiceDeps = {
loadPluginProviderRuntime: async (): Promise<ProviderAuthChoiceRuntime> =>
import("./provider-auth-choice.runtime.js"),
};
let providerAuthChoiceDeps = defaultProviderAuthChoiceDeps;
async function loadPluginProviderRuntime() {
return import("./provider-auth-choice.runtime.js");
return await providerAuthChoiceDeps.loadPluginProviderRuntime();
}
export const __testing = {
resetDepsForTest(): void {
providerAuthChoiceDeps = defaultProviderAuthChoiceDeps;
},
setDepsForTest(deps: Partial<typeof defaultProviderAuthChoiceDeps>): void {
providerAuthChoiceDeps = {
...defaultProviderAuthChoiceDeps,
...deps,
};
},
} as const;
export async function runProviderPluginAuthMethod(params: {
config: OpenClawConfig;
env?: NodeJS.ProcessEnv;