test(plugins): assert legacy channel schema exports

This commit is contained in:
Vincent Koc
2026-04-24 17:57:58 -07:00
parent 3a14a95085
commit 2d2402cee8

View File

@@ -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 \{(?<exports>[\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 \{(?<exports>[\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))