mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-29 10:50:58 +00:00
Tests: remove stale runtime state setup
This commit is contained in:
@@ -45,23 +45,4 @@ describe("ensureRuntimePluginsLoaded", () => {
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("reloads when the current active registry is incompatible with the request", async () => {
|
||||
const { ensureRuntimePluginsLoaded } = await import("./runtime-plugins.js");
|
||||
|
||||
ensureRuntimePluginsLoaded({
|
||||
config: {} as never,
|
||||
workspaceDir: "/tmp/workspace",
|
||||
allowGatewaySubagentBinding: true,
|
||||
});
|
||||
|
||||
expect(hoisted.resolveRuntimePluginRegistry).toHaveBeenCalledWith({
|
||||
config: {} as never,
|
||||
workspaceDir: "/tmp/workspace",
|
||||
runtimeOptions: {
|
||||
allowGatewaySubagentBinding: true,
|
||||
},
|
||||
});
|
||||
expect(hoisted.resolveRuntimePluginRegistry).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { createEmptyPluginRegistry } from "../plugins/registry.js";
|
||||
import { resetPluginRuntimeStateForTest, setActivePluginRegistry } from "../plugins/runtime.js";
|
||||
|
||||
const { resolveRuntimePluginRegistryMock } = vi.hoisted(() => ({
|
||||
resolveRuntimePluginRegistryMock: vi.fn<
|
||||
@@ -19,7 +18,6 @@ describe("image-generation provider registry", () => {
|
||||
afterEach(() => {
|
||||
resolveRuntimePluginRegistryMock.mockReset();
|
||||
resolveRuntimePluginRegistryMock.mockReturnValue(undefined);
|
||||
resetPluginRuntimeStateForTest();
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
@@ -51,7 +49,6 @@ describe("image-generation provider registry", () => {
|
||||
}),
|
||||
},
|
||||
});
|
||||
setActivePluginRegistry(registry);
|
||||
resolveRuntimePluginRegistryMock.mockReturnValue(registry);
|
||||
|
||||
const provider = getImageGenerationProvider("custom-image");
|
||||
@@ -96,7 +93,6 @@ describe("image-generation provider registry", () => {
|
||||
},
|
||||
},
|
||||
);
|
||||
setActivePluginRegistry(registry);
|
||||
resolveRuntimePluginRegistryMock.mockReturnValue(registry);
|
||||
|
||||
expect(listImageGenerationProviders().map((provider) => provider.id)).toEqual(["safe-image"]);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import { createEmptyPluginRegistry } from "./registry.js";
|
||||
import { resetPluginRuntimeStateForTest } from "./runtime.js";
|
||||
|
||||
type MockManifestRegistry = {
|
||||
plugins: Array<Record<string, unknown>>;
|
||||
@@ -109,7 +108,6 @@ function setBundledCapabilityFixture(contractKey: string) {
|
||||
describe("resolvePluginCapabilityProviders", () => {
|
||||
beforeEach(async () => {
|
||||
vi.resetModules();
|
||||
resetPluginRuntimeStateForTest();
|
||||
mocks.resolveRuntimePluginRegistry.mockReset();
|
||||
mocks.resolveRuntimePluginRegistry.mockReturnValue(undefined);
|
||||
mocks.loadPluginManifestRegistry.mockReset();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import { createEmptyPluginRegistry } from "../plugins/registry-empty.js";
|
||||
import { resetPluginRuntimeStateForTest, setActivePluginRegistry } from "../plugins/runtime.js";
|
||||
import type { SpeechProviderPlugin } from "../plugins/types.js";
|
||||
|
||||
const resolveRuntimePluginRegistryMock = vi.fn();
|
||||
@@ -34,7 +33,6 @@ function createSpeechProvider(id: string, aliases?: string[]): SpeechProviderPlu
|
||||
describe("speech provider registry", () => {
|
||||
beforeEach(async () => {
|
||||
vi.resetModules();
|
||||
resetPluginRuntimeStateForTest();
|
||||
resolveRuntimePluginRegistryMock.mockReset();
|
||||
resolveRuntimePluginRegistryMock.mockReturnValue(undefined);
|
||||
({
|
||||
@@ -45,21 +43,9 @@ describe("speech provider registry", () => {
|
||||
} = await import("./provider-registry.js"));
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
resetPluginRuntimeStateForTest();
|
||||
});
|
||||
afterEach(() => {});
|
||||
|
||||
it("uses active plugin speech providers without reloading plugins", () => {
|
||||
setActivePluginRegistry({
|
||||
...createEmptyPluginRegistry(),
|
||||
speechProviders: [
|
||||
{
|
||||
pluginId: "test-demo-speech",
|
||||
source: "test",
|
||||
provider: createSpeechProvider("demo-speech"),
|
||||
},
|
||||
],
|
||||
});
|
||||
resolveRuntimePluginRegistryMock.mockReturnValue({
|
||||
...createEmptyPluginRegistry(),
|
||||
speechProviders: [
|
||||
@@ -112,16 +98,6 @@ describe("speech provider registry", () => {
|
||||
});
|
||||
|
||||
it("canonicalizes the legacy edge alias to microsoft", () => {
|
||||
setActivePluginRegistry({
|
||||
...createEmptyPluginRegistry(),
|
||||
speechProviders: [
|
||||
{
|
||||
pluginId: "test-microsoft",
|
||||
source: "test",
|
||||
provider: createSpeechProvider("microsoft", ["edge"]),
|
||||
},
|
||||
],
|
||||
});
|
||||
resolveRuntimePluginRegistryMock.mockReturnValue({
|
||||
...createEmptyPluginRegistry(),
|
||||
speechProviders: [
|
||||
|
||||
Reference in New Issue
Block a user