refactor: reuse gateway output helpers

This commit is contained in:
Peter Steinberger
2026-01-07 01:43:02 +00:00
parent b88c4e9d20
commit 15b7560a9b
5 changed files with 94 additions and 15 deletions

View File

@@ -2,6 +2,7 @@ import { describe, expect, it } from "vitest";
import {
buildOutboundDeliveryJson,
formatGatewaySummary,
formatOutboundDeliverySummary,
} from "./format.js";
@@ -87,3 +88,21 @@ describe("buildOutboundDeliveryJson", () => {
});
});
});
describe("formatGatewaySummary", () => {
it("formats gateway summaries with provider", () => {
expect(
formatGatewaySummary({ provider: "whatsapp", messageId: "m1" }),
).toBe("✅ Sent via gateway (whatsapp). Message ID: m1");
});
it("supports custom actions", () => {
expect(
formatGatewaySummary({
action: "Poll sent",
provider: "discord",
messageId: "p1",
}),
).toBe("✅ Poll sent via gateway (discord). Message ID: p1");
});
});