Files
openclaw/src/plugins/web-provider-resolution-shared.test.ts
Vincent Koc 6a189eec0b fix(plugins): centralize explicit plugin scope handling (#65298)
* 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
2026-04-12 16:16:37 +01:00

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([]);
});
});