mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 07:50:43 +00:00
test(plugins): assert legacy channel schema exports
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user