mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 04:30:43 +00:00
* fix(plugins): centralize explicit plugin scope handling * fix(plugins): preserve explicit empty web scopes * fix(plugins): preserve runtime web provider scopes without config * fix(plugins): preserve web provider runtime filtering * fix(plugins): preserve scoped web runtime fallback * fix(plugins): harden plugin scope normalization
39 lines
1011 B
TypeScript
39 lines
1011 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import {
|
|
buildWebProviderSnapshotCacheKey,
|
|
mapRegistryProviders,
|
|
} from "./web-provider-resolution-shared.js";
|
|
|
|
describe("web-provider-resolution-shared", () => {
|
|
it("distinguishes explicit empty plugin scopes in cache keys", () => {
|
|
const unscoped = buildWebProviderSnapshotCacheKey({
|
|
envKey: "demo",
|
|
});
|
|
const scopedEmpty = buildWebProviderSnapshotCacheKey({
|
|
envKey: "demo",
|
|
onlyPluginIds: [],
|
|
});
|
|
|
|
expect(scopedEmpty).not.toBe(unscoped);
|
|
});
|
|
|
|
it("treats explicit empty plugin scopes as scoped-empty when mapping providers", () => {
|
|
const providers = mapRegistryProviders({
|
|
entries: [
|
|
{
|
|
pluginId: "alpha",
|
|
provider: { id: "alpha-provider" },
|
|
},
|
|
{
|
|
pluginId: "beta",
|
|
provider: { id: "beta-provider" },
|
|
},
|
|
],
|
|
onlyPluginIds: [],
|
|
sortProviders: (values) => values,
|
|
});
|
|
|
|
expect(providers).toEqual([]);
|
|
});
|
|
});
|