import { describe, expect, it } from "vitest"; import { resolveCronDeliveryPlan, resolveFailureDestination } from "./delivery-plan.js"; import { makeCronJob } from "./delivery.test-helpers.js";
describe("resolveCronDeliveryPlan", () => {
it("defaults to announce when delivery object has no mode", () => { const plan = resolveCronDeliveryPlan(
makeCronJob({
delivery: { channel: "telegram", to: "123", mode: undefined as never },
}),
);
expect(plan.mode).toBe("announce");
expect(plan.requested).toBe(true);
expect(plan.channel).toBe("telegram");
expect(plan.to).toBe("123");
});
it("returns null when webhook failure destination matches the primary webhook target", () => { const plan = resolveFailureDestination(
makeCronJob({
sessionTarget: "main",
payload: { kind: "systemEvent", text: "tick" },
delivery: {
mode: "webhook",
to: "https://example.invalid/cron",
failureDestination: {
mode: "webhook",
to: "https://example.invalid/cron",
},
},
}),
undefined,
);
expect(plan).toBeNull();
});
it("does not reuse inherited announce recipient when switching failure destination to webhook", () => { const plan = resolveFailureDestination(
makeCronJob({
delivery: {
mode: "announce",
channel: "telegram",
to: "111",
failureDestination: {
mode: "webhook",
},
},
}),
{
channel: "signal",
to: "group-abc",
mode: "announce",
},
);
expect(plan).toBeNull();
});
it("allows job-level failure destination fields to clear inherited global values", () => { const plan = resolveFailureDestination(
makeCronJob({
delivery: {
mode: "announce",
channel: "telegram",
to: "111",
failureDestination: {
mode: "announce",
channel: undefined as never,
to: undefined as never,
accountId: undefined as never,
},
},
}),
{
channel: "signal",
to: "group-abc",
accountId: "global-account",
mode: "announce",
},
);
expect(plan).toEqual({
mode: "announce",
channel: "last",
to: undefined,
accountId: undefined,
});
});
});
Messung V0.5 in Prozent
¤ 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.0.1Bemerkung:
(vorverarbeitet am 2026-09-28)
¤
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.