Skip to content

Commit ad2f5cd

Browse files
committed
test(heartbeat): cover delivery chat type inference
1 parent 0078b90 commit ad2f5cd

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

src/infra/heartbeat-runner.returns-default-unset.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,17 @@ beforeAll(async () => {
288288
},
289289
};
290290

291+
const discordPlugin = createOutboundTestPlugin({
292+
id: "discord",
293+
outbound: {
294+
deliveryMode: "direct",
295+
},
296+
});
297+
291298
testRegistry = createTestRegistry([
292299
{ pluginId: "whatsapp", plugin: whatsappPlugin, source: "test" },
293300
{ pluginId: "telegram", plugin: telegramPlugin, source: "test" },
301+
{ pluginId: "discord", plugin: discordPlugin, source: "test" },
294302
]);
295303
setActivePluginRegistry(testRegistry);
296304

@@ -519,6 +527,20 @@ describe("resolveHeartbeatDeliveryTarget", () => {
519527
expected: {
520528
channel: "telegram",
521529
to: "-100123",
530+
chatType: "group",
531+
accountId: undefined,
532+
lastChannel: undefined,
533+
lastAccountId: undefined,
534+
},
535+
},
536+
{
537+
name: "infer explicit discord channel target",
538+
cfg: { agents: { defaults: { heartbeat: { target: "discord", to: "channel:123" } } } },
539+
entry: baseEntry,
540+
expected: {
541+
channel: "discord",
542+
to: "channel:123",
543+
chatType: "channel",
522544
accountId: undefined,
523545
lastChannel: undefined,
524546
lastAccountId: undefined,
@@ -531,6 +553,7 @@ describe("resolveHeartbeatDeliveryTarget", () => {
531553
expected: {
532554
channel: "telegram",
533555
to: "5232990709",
556+
chatType: "direct",
534557
accountId: undefined,
535558
lastChannel: "telegram",
536559
lastAccountId: undefined,
@@ -581,6 +604,7 @@ describe("resolveHeartbeatDeliveryTarget", () => {
581604
expected: {
582605
channel: "telegram",
583606
to: "-100123",
607+
chatType: "group",
584608
accountId: "work",
585609
lastChannel: undefined,
586610
lastAccountId: undefined,

0 commit comments

Comments
 (0)