mirror of https://github.com/openclaw/openclaw.git
perf(test): fold pi extensions runtime registry tests into agents suite
This commit is contained in:
parent
412c1d0af1
commit
fddf8a6f4a
|
|
@ -1,5 +1,6 @@
|
|||
import { describe, expect, it } from "vitest";
|
||||
import { applyConfiguredContextWindows } from "./context.js";
|
||||
import { createSessionManagerRuntimeRegistry } from "./pi-extensions/session-manager-runtime-registry.js";
|
||||
|
||||
describe("applyConfiguredContextWindows", () => {
|
||||
it("overrides discovered cache values with explicit models.providers contextWindow", () => {
|
||||
|
|
@ -39,3 +40,23 @@ describe("applyConfiguredContextWindows", () => {
|
|||
expect(cache.has("bad/model")).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("createSessionManagerRuntimeRegistry", () => {
|
||||
it("stores, reads, and clears values by object identity", () => {
|
||||
const registry = createSessionManagerRuntimeRegistry<{ value: number }>();
|
||||
const key = {};
|
||||
expect(registry.get(key)).toBeNull();
|
||||
registry.set(key, { value: 1 });
|
||||
expect(registry.get(key)).toEqual({ value: 1 });
|
||||
registry.set(key, null);
|
||||
expect(registry.get(key)).toBeNull();
|
||||
});
|
||||
|
||||
it("ignores non-object keys", () => {
|
||||
const registry = createSessionManagerRuntimeRegistry<{ value: number }>();
|
||||
registry.set(null, { value: 1 });
|
||||
registry.set(123, { value: 1 });
|
||||
expect(registry.get(null)).toBeNull();
|
||||
expect(registry.get(123)).toBeNull();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
import { describe, expect, it } from "vitest";
|
||||
import { createSessionManagerRuntimeRegistry } from "./session-manager-runtime-registry.js";
|
||||
|
||||
describe("createSessionManagerRuntimeRegistry", () => {
|
||||
it("stores, reads, and clears values by object identity", () => {
|
||||
const registry = createSessionManagerRuntimeRegistry<{ value: number }>();
|
||||
const key = {};
|
||||
expect(registry.get(key)).toBeNull();
|
||||
registry.set(key, { value: 1 });
|
||||
expect(registry.get(key)).toEqual({ value: 1 });
|
||||
registry.set(key, null);
|
||||
expect(registry.get(key)).toBeNull();
|
||||
});
|
||||
|
||||
it("ignores non-object keys", () => {
|
||||
const registry = createSessionManagerRuntimeRegistry<{ value: number }>();
|
||||
registry.set(null, { value: 1 });
|
||||
registry.set(123, { value: 1 });
|
||||
expect(registry.get(null)).toBeNull();
|
||||
expect(registry.get(123)).toBeNull();
|
||||
});
|
||||
});
|
||||
Loading…
Reference in New Issue