mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 09:10:45 +00:00
test(plugins): satisfy web provider lint
This commit is contained in:
@@ -6,7 +6,7 @@ const mocks = vi.hoisted(() => ({
|
||||
resolveCompatibleRuntimePluginRegistry: vi.fn(),
|
||||
resolvePluginRegistryLoadCacheKey: vi.fn((options: unknown) => JSON.stringify(options)),
|
||||
resolveRuntimePluginRegistry: vi.fn(),
|
||||
getActivePluginRegistry: vi.fn<() => unknown | null>(() => null),
|
||||
getActivePluginRegistry: vi.fn<() => Record<string, unknown> | null>(() => null),
|
||||
getActivePluginRegistryWorkspaceDir: vi.fn(() => undefined),
|
||||
buildPluginRuntimeLoadOptionsFromValues: vi.fn(
|
||||
(_values: unknown, overrides?: Record<string, unknown>) => ({
|
||||
|
||||
@@ -58,10 +58,19 @@ type ResolveWebProviderRuntimeDeps<TEntry> = {
|
||||
}) => TEntry[] | null;
|
||||
};
|
||||
|
||||
type WebProviderRuntimeContext = {
|
||||
env: NonNullable<PluginLoadOptions["env"]>;
|
||||
workspaceDir?: string;
|
||||
config: PluginLoadOptions["config"];
|
||||
activationSourceConfig?: PluginLoadOptions["config"];
|
||||
autoEnabledReasons: Record<string, string[]>;
|
||||
onlyPluginIds?: string[];
|
||||
};
|
||||
|
||||
function resolveWebProviderRuntimeContext<TEntry>(
|
||||
params: ResolvePluginWebProvidersParams,
|
||||
deps: ResolveWebProviderRuntimeDeps<TEntry>,
|
||||
) {
|
||||
): WebProviderRuntimeContext {
|
||||
const env = params.env ?? process.env;
|
||||
const workspaceDir = params.workspaceDir ?? getActivePluginRegistryWorkspaceDir();
|
||||
const { config, activationSourceConfig, autoEnabledReasons } =
|
||||
@@ -89,8 +98,8 @@ function resolveWebProviderRuntimeContext<TEntry>(
|
||||
};
|
||||
}
|
||||
|
||||
function resolveWebProviderLoadOptions<TEntry>(
|
||||
context: ReturnType<typeof resolveWebProviderRuntimeContext<TEntry>>,
|
||||
function resolveWebProviderLoadOptions(
|
||||
context: WebProviderRuntimeContext,
|
||||
params: ResolvePluginWebProvidersParams,
|
||||
) {
|
||||
return buildPluginRuntimeLoadOptionsFromValues(
|
||||
|
||||
Reference in New Issue
Block a user