diff --git a/src/plugins/contracts/registry.contract.test.ts b/src/plugins/contracts/registry.contract.test.ts index 78b26059f0d..95669f96c11 100644 --- a/src/plugins/contracts/registry.contract.test.ts +++ b/src/plugins/contracts/registry.contract.test.ts @@ -8,12 +8,6 @@ import { pluginRegistrationContractRegistry, providerContractLoadError, providerContractPluginIds, - realtimeTranscriptionProviderContractRegistry, - realtimeVoiceProviderContractRegistry, - resolveWebFetchProviderContractEntriesForPluginId, - resolveWebSearchProviderContractEntriesForPluginId, - speechProviderContractRegistry, - webFetchProviderContractRegistry, } from "./registry.js"; const REGISTRY_CONTRACT_TIMEOUT_MS = 300_000; @@ -82,11 +76,15 @@ describe("plugin contract registry", () => { }, { name: "does not duplicate bundled realtime transcription provider ids", - ids: () => realtimeTranscriptionProviderContractRegistry.map((entry) => entry.provider.id), + ids: () => + pluginRegistrationContractRegistry.flatMap( + (entry) => entry.realtimeTranscriptionProviderIds, + ), }, { name: "does not duplicate bundled realtime voice provider ids", - ids: () => realtimeVoiceProviderContractRegistry.map((entry) => entry.provider.id), + ids: () => + pluginRegistrationContractRegistry.flatMap((entry) => entry.realtimeVoiceProviderIds), }, { name: "does not duplicate bundled image-generation provider ids", @@ -101,7 +99,9 @@ describe("plugin contract registry", () => { "does not duplicate bundled speech provider ids", { timeout: REGISTRY_CONTRACT_TIMEOUT_MS }, () => { - expectUniqueIds(speechProviderContractRegistry.map((entry) => entry.provider.id)); + expectUniqueIds( + pluginRegistrationContractRegistry.flatMap((entry) => entry.speechProviderIds), + ); }, ); @@ -114,7 +114,9 @@ describe("plugin contract registry", () => { it("covers every bundled speech plugin discovered from manifests", () => { expectRegistryPluginIds({ - actualPluginIds: speechProviderContractRegistry.map((entry) => entry.pluginId), + actualPluginIds: pluginRegistrationContractRegistry + .filter((entry) => entry.speechProviderIds.length > 0) + .map((entry) => entry.pluginId), predicate: (plugin) => plugin.origin === "bundled" && (plugin.contracts?.speechProviders?.length ?? 0) > 0, }); @@ -122,7 +124,9 @@ describe("plugin contract registry", () => { it("covers every bundled realtime voice plugin discovered from manifests", () => { expectRegistryPluginIds({ - actualPluginIds: realtimeVoiceProviderContractRegistry.map((entry) => entry.pluginId), + actualPluginIds: pluginRegistrationContractRegistry + .filter((entry) => entry.realtimeVoiceProviderIds.length > 0) + .map((entry) => entry.pluginId), predicate: (plugin) => plugin.origin === "bundled" && (plugin.contracts?.realtimeVoiceProviders?.length ?? 0) > 0, }); @@ -130,7 +134,9 @@ describe("plugin contract registry", () => { it("covers every bundled realtime transcription plugin discovered from manifests", () => { expectRegistryPluginIds({ - actualPluginIds: realtimeTranscriptionProviderContractRegistry.map((entry) => entry.pluginId), + actualPluginIds: pluginRegistrationContractRegistry + .filter((entry) => entry.realtimeTranscriptionProviderIds.length > 0) + .map((entry) => entry.pluginId), predicate: (plugin) => plugin.origin === "bundled" && (plugin.contracts?.realtimeTranscriptionProviders?.length ?? 0) > 0, @@ -156,15 +162,17 @@ describe("plugin contract registry", () => { "loads bundled web fetch providers for each shared-resolver plugin", { timeout: REGISTRY_CONTRACT_TIMEOUT_MS }, () => { + const entriesByPluginId = new Map( + pluginRegistrationContractRegistry + .filter((entry) => entry.webFetchProviderIds.length > 0) + .map((entry) => [entry.pluginId, entry.webFetchProviderIds] as const), + ); for (const pluginId of resolveManifestContractPluginIds({ contract: "webFetchProviders", origin: "bundled", })) { - expect(resolveWebFetchProviderContractEntriesForPluginId(pluginId).length).toBeGreaterThan( - 0, - ); + expect(entriesByPluginId.get(pluginId)?.length ?? 0).toBeGreaterThan(0); } - expect(webFetchProviderContractRegistry.length).toBeGreaterThan(0); }, ); @@ -187,13 +195,16 @@ describe("plugin contract registry", () => { "loads bundled web search providers for each shared-resolver plugin", { timeout: REGISTRY_CONTRACT_TIMEOUT_MS }, () => { + const entriesByPluginId = new Map( + pluginRegistrationContractRegistry + .filter((entry) => entry.webSearchProviderIds.length > 0) + .map((entry) => [entry.pluginId, entry.webSearchProviderIds] as const), + ); for (const pluginId of resolveManifestContractPluginIds({ contract: "webSearchProviders", origin: "bundled", })) { - expect(resolveWebSearchProviderContractEntriesForPluginId(pluginId).length).toBeGreaterThan( - 0, - ); + expect(entriesByPluginId.get(pluginId)?.length ?? 0).toBeGreaterThan(0); } }, ); diff --git a/test/helpers/plugins/bundled-web-search-fast-path-contract.ts b/test/helpers/plugins/bundled-web-search-fast-path-contract.ts index d56d50d84d2..84e40c2a0c5 100644 --- a/test/helpers/plugins/bundled-web-search-fast-path-contract.ts +++ b/test/helpers/plugins/bundled-web-search-fast-path-contract.ts @@ -100,9 +100,10 @@ export function describeBundledWebSearchFastPathContract(pluginId: string) { origin: "bundled", onlyPluginIds: [pluginId], }).filter((provider) => provider.pluginId === pluginId); + const pluginSdkResolution = process.env.VITEST ? "src" : "dist"; const bundledProviderEntries = loadBundledCapabilityRuntimeRegistry({ pluginIds: [pluginId], - pluginSdkResolution: "dist", + pluginSdkResolution, }) .webSearchProviders.filter((entry) => entry.pluginId === pluginId) .map((entry) => ({