mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-22 15:31:07 +00:00
fix(ci): reset deep test runtime state
This commit is contained in:
@@ -4,6 +4,7 @@ import { createEmptyPluginRegistry } from "./registry.js";
|
||||
import {
|
||||
pinActivePluginHttpRouteRegistry,
|
||||
releasePinnedPluginHttpRouteRegistry,
|
||||
resetPluginRuntimeStateForTest,
|
||||
setActivePluginRegistry,
|
||||
} from "./runtime.js";
|
||||
|
||||
@@ -45,7 +46,7 @@ function expectRouteRegistrationDenied(params: {
|
||||
describe("registerPluginHttpRoute", () => {
|
||||
afterEach(() => {
|
||||
releasePinnedPluginHttpRouteRegistry();
|
||||
setActivePluginRegistry(createEmptyPluginRegistry());
|
||||
resetPluginRuntimeStateForTest();
|
||||
});
|
||||
|
||||
it("registers route and unregisters it", () => {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { createEmptyPluginRegistry } from "./registry.js";
|
||||
import {
|
||||
pinActivePluginHttpRouteRegistry,
|
||||
releasePinnedPluginHttpRouteRegistry,
|
||||
resetPluginRuntimeStateForTest,
|
||||
resolveActivePluginHttpRouteRegistry,
|
||||
setActivePluginRegistry,
|
||||
} from "./runtime.js";
|
||||
@@ -10,7 +11,7 @@ import {
|
||||
describe("plugin runtime route registry", () => {
|
||||
afterEach(() => {
|
||||
releasePinnedPluginHttpRouteRegistry();
|
||||
setActivePluginRegistry(createEmptyPluginRegistry());
|
||||
resetPluginRuntimeStateForTest();
|
||||
});
|
||||
|
||||
it("keeps the pinned route registry when the active plugin registry changes", () => {
|
||||
|
||||
@@ -98,3 +98,12 @@ export function getActivePluginRegistryKey(): string | null {
|
||||
export function getActivePluginRegistryVersion(): number {
|
||||
return state.version;
|
||||
}
|
||||
|
||||
export function resetPluginRuntimeStateForTest(): void {
|
||||
const emptyRegistry = createEmptyPluginRegistry();
|
||||
state.registry = emptyRegistry;
|
||||
state.httpRouteRegistry = emptyRegistry;
|
||||
state.httpRouteRegistryPinned = false;
|
||||
state.key = null;
|
||||
state.version += 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user