mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-03 22:40:26 +00:00
refactor: split gateway plugin bootstrap and registry surfaces
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import { createEmptyPluginRegistry } from "./registry.js";
|
||||
import {
|
||||
getActivePluginHttpRouteRegistryVersion,
|
||||
getActivePluginRegistryVersion,
|
||||
getActivePluginRegistry,
|
||||
pinActivePluginHttpRouteRegistry,
|
||||
releasePinnedPluginHttpRouteRegistry,
|
||||
@@ -32,6 +34,23 @@ describe("plugin runtime route registry", () => {
|
||||
expect(resolveActivePluginHttpRouteRegistry(laterRegistry)).toBe(startupRegistry);
|
||||
});
|
||||
|
||||
it("tracks route registry repins separately from the active registry version", () => {
|
||||
const startupRegistry = createEmptyPluginRegistry();
|
||||
const laterRegistry = createEmptyPluginRegistry();
|
||||
const repinnedRegistry = createEmptyPluginRegistry();
|
||||
|
||||
setActivePluginRegistry(startupRegistry);
|
||||
pinActivePluginHttpRouteRegistry(laterRegistry);
|
||||
|
||||
const activeVersionBeforeRepin = getActivePluginRegistryVersion();
|
||||
const routeVersionBeforeRepin = getActivePluginHttpRouteRegistryVersion();
|
||||
|
||||
pinActivePluginHttpRouteRegistry(repinnedRegistry);
|
||||
|
||||
expect(getActivePluginRegistryVersion()).toBe(activeVersionBeforeRepin);
|
||||
expect(getActivePluginHttpRouteRegistryVersion()).toBe(routeVersionBeforeRepin + 1);
|
||||
});
|
||||
|
||||
it("falls back to the provided registry when the pinned route registry has no routes", () => {
|
||||
const startupRegistry = createEmptyPluginRegistry();
|
||||
const explicitRegistry = createEmptyPluginRegistry();
|
||||
|
||||
Reference in New Issue
Block a user