diff --git a/src/plugins/contracts/config-footprint-guardrails.test.ts b/src/plugins/contracts/config-footprint-guardrails.test.ts index 7561ecfeb9a..1fd5c1cdcd7 100644 --- a/src/plugins/contracts/config-footprint-guardrails.test.ts +++ b/src/plugins/contracts/config-footprint-guardrails.test.ts @@ -164,14 +164,17 @@ describe("config footprint guardrails", () => { it("keeps bundled channel schemas as a fixed legacy SDK compatibility surface", () => { const source = readSource("src/plugin-sdk/channel-config-schema.ts"); - const providersCoreExports = source.match( - /Legacy bundled channel schema exports[\s\S]*?export \{(?[\s\S]*?)\} from "\.\.\/config\/zod-schema\.providers-core\.js";/, - )?.groups?.exports; - expect(providersCoreExports).toBeDefined(); - const exportedSchemaNames = Array.from( - `${providersCoreExports ?? ""}\nWhatsAppConfigSchema`.matchAll( - /\b([A-Z][A-Za-z0-9]+ConfigSchema)\b/g, + const legacySection = source.slice(source.indexOf("Legacy bundled channel schema exports")); + const bundledSchemaExportBlocks = Array.from( + legacySection.matchAll( + /export \{(?[\s\S]*?)\} from "\.\.\/config\/zod-schema\.providers-(?:core|whatsapp)\.js";/g, ), + ) + .map((match) => match.groups?.exports) + .filter((block): block is string => Boolean(block)); + expect(bundledSchemaExportBlocks).toHaveLength(2); + const exportedSchemaNames = Array.from( + bundledSchemaExportBlocks.join("\n").matchAll(/\b([A-Z][A-Za-z0-9]+ConfigSchema)\b/g), ) .map((match) => match[1]) .filter((name): name is string => Boolean(name))