import { describe, expect, it, vi } from "vitest"; import type { PluginManifestRecord, PluginManifestRegistry } from "../plugins/manifest-registry.js"; import {
validateConfigObjectRawWithPlugins,
validateConfigObjectWithPlugins,
} from "./validation.js";
describe("validateConfigObjectRawWithPlugins channel metadata", () => {
it("still injects channel AJV defaults even in raw mode — persistence safety is handled by io.ts", async () => { // Channel and plugin AJV validation always runs with applyDefaults: true // (hardcoded) to avoid breaking schemas that mark defaulted fields as // required (e.g., BlueBubbles enrichGroupParticipantsFromContacts). // // The actual protection against leaking these defaults to disk lives in // writeConfigFile (io.ts), which uses persistCandidate (the pre-validation // merge-patched value) instead of validated.config.
setupTelegramSchemaWithDefault();
const result = validateConfigObjectRawWithPlugins({
channels: {
telegram: {},
},
});
expect(result.ok).toBe(true); if (result.ok) { // AJV defaults ARE injected into validated.config even in raw mode. // This is intentional — see comment above.
expect(result.config.channels?.telegram).toEqual(
expect.objectContaining({ dmPolicy: "pairing" }),
);
}
});
});
describe("validateConfigObjectRawWithPlugins plugin config defaults", () => {
it("does not inject plugin AJV defaults in raw mode for plugin-owned config", async () => {
setupPluginSchemaWithRequiredDefault();
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.