Skip to content

Commit 7799e53

Browse files
fix(outbound): keep Discord runtime adapters resolvable
1 parent 4cbba1f commit 7799e53

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

src/infra/outbound/channel-bootstrap.runtime.test.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,39 @@ describe("bootstrapOutboundChannelPlugin", () => {
110110
expect(loaderMocks.resolveRuntimePluginRegistry).not.toHaveBeenCalled();
111111
});
112112

113+
it("skips bootstrap when the active replacement registry has a message send surface", () => {
114+
const setup = createEmptyPluginRegistry();
115+
setup.channels = [
116+
{
117+
pluginId: "discord",
118+
plugin: { id: "discord", meta: {} },
119+
source: "setup",
120+
},
121+
] as never;
122+
const runtime = createEmptyPluginRegistry();
123+
runtime.channels = [
124+
{
125+
pluginId: "discord",
126+
plugin: {
127+
id: "discord",
128+
meta: {},
129+
message: { send: { text: async () => ({ messageId: "1" }) } },
130+
},
131+
source: "runtime",
132+
},
133+
] as never;
134+
setActivePluginRegistry(setup);
135+
pinActivePluginChannelRegistry(setup);
136+
setActivePluginRegistry(runtime);
137+
138+
bootstrapOutboundChannelPlugin({
139+
channel: "discord",
140+
cfg: discordConfig,
141+
});
142+
143+
expect(loaderMocks.resolveRuntimePluginRegistry).not.toHaveBeenCalled();
144+
});
145+
113146
it("retries when bootstrap returns without making the channel send-capable", () => {
114147
const registry = createEmptyPluginRegistry();
115148
registry.channels = [

0 commit comments

Comments
 (0)