test: speed up plugin state runtime test

This commit is contained in:
Shakker
2026-05-09 23:16:23 +01:00
parent d9d8439dfd
commit 7768d1374a

View File

@@ -1,7 +1,8 @@
import { afterEach, describe, expect, it, vi } from "vitest";
import { resolveStateDir } from "../config/paths.js";
import type { PluginRecord } from "../plugins/registry-types.js";
import { createPluginRegistry } from "../plugins/registry.js";
import { createPluginRuntime } from "../plugins/runtime/index.js";
import type { PluginRuntime } from "../plugins/runtime/types.js";
import { withOpenClawTestState } from "../test-utils/openclaw-test-state.js";
import { resetPluginStateStoreForTests } from "./plugin-state-store.js";
@@ -44,7 +45,14 @@ function createPluginRecord(id: string, origin: PluginRecord["origin"] = "bundle
function createTestPluginRegistry() {
return createPluginRegistry({
logger: { info: vi.fn(), warn: vi.fn(), error: vi.fn(), debug: vi.fn() },
runtime: createPluginRuntime(),
runtime: {
state: {
resolveStateDir,
openKeyedStore: () => {
throw new Error("registry plugin runtime proxy should bind openKeyedStore");
},
},
} as PluginRuntime,
});
}