mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-19 13:11:40 +00:00
test: keep web provider artifact coverage manifest-only
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user