test: keep web provider artifact coverage manifest-only

This commit is contained in:
Peter Steinberger
2026-04-08 13:58:27 +01:00
parent 88282f7b23
commit a5515db1e8
2 changed files with 21 additions and 20 deletions

View File

@@ -166,3 +166,11 @@ export const BUNDLED_AUTO_ENABLE_PROVIDER_PLUGIN_IDS = Object.fromEntries(
]),
).toSorted(([left], [right]) => left.localeCompare(right)),
) as Readonly<Record<string, string>>;
export function resolveBundledContractSnapshotPluginIds(
key: keyof Omit<BundledPluginContractSnapshot, "pluginId">,
): string[] {
return BUNDLED_PLUGIN_CONTRACT_SNAPSHOTS.filter((entry) => entry[key].length > 0)
.map((entry) => entry.pluginId)
.toSorted((left, right) => left.localeCompare(right));
}

View File

@@ -1,4 +1,5 @@
import { describe, expect, it } from "vitest";
import { resolveBundledContractSnapshotPluginIds } from "./contracts/inventory/bundled-capability-metadata.js";
import { resolveManifestContractPluginIds } from "./manifest-registry.js";
import {
resolveBundledWebFetchProvidersFromPublicArtifacts,
@@ -7,16 +8,7 @@ import {
describe("web provider public artifacts", () => {
it("covers every bundled web search provider declared in manifests", () => {
const providers = resolveBundledWebSearchProvidersFromPublicArtifacts({
bundledAllowlistCompat: true,
});
expect(providers).not.toBeNull();
expect(
providers
?.map((entry) => entry.pluginId)
.toSorted((left, right) => left.localeCompare(right)),
).toEqual(
expect(resolveBundledContractSnapshotPluginIds("webSearchProviderIds")).toEqual(
resolveManifestContractPluginIds({
contract: "webSearchProviders",
origin: "bundled",
@@ -25,16 +17,7 @@ describe("web provider public artifacts", () => {
});
it("covers every bundled web fetch provider declared in manifests", () => {
const providers = resolveBundledWebFetchProvidersFromPublicArtifacts({
bundledAllowlistCompat: true,
});
expect(providers).not.toBeNull();
expect(
providers
?.map((entry) => entry.pluginId)
.toSorted((left, right) => left.localeCompare(right)),
).toEqual(
expect(resolveBundledContractSnapshotPluginIds("webFetchProviderIds")).toEqual(
resolveManifestContractPluginIds({
contract: "webFetchProviders",
origin: "bundled",
@@ -42,6 +25,16 @@ describe("web provider public artifacts", () => {
);
});
it("loads a lightweight bundled web search artifact smoke", () => {
const provider = resolveBundledWebSearchProvidersFromPublicArtifacts({
bundledAllowlistCompat: true,
onlyPluginIds: ["brave"],
})?.[0];
expect(provider?.pluginId).toBe("brave");
expect(provider?.createTool({ config: {} as never })).toBeNull();
});
it("prefers lightweight bundled web fetch contract artifacts", () => {
const provider = resolveBundledWebFetchProvidersFromPublicArtifacts({
bundledAllowlistCompat: true,