refactor: reuse gateway output helpers
This commit is contained in:
@@ -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");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user