@@ -54,6 +54,7 @@ function createTestPlugin(params?: {
|
54 | 54 | order?: number; |
55 | 55 | account?: TestAccount; |
56 | 56 | startAccount?: NonNullable<ChannelPlugin<TestAccount>["gateway"]>["startAccount"]; |
| 57 | +stopAccount?: NonNullable<ChannelPlugin<TestAccount>["gateway"]>["stopAccount"]; |
57 | 58 | listAccountIds?: ChannelPlugin<TestAccount>["config"]["listAccountIds"]; |
58 | 59 | includeDescribeAccount?: boolean; |
59 | 60 | describeAccount?: ChannelPlugin<TestAccount>["config"]["describeAccount"]; |
@@ -82,6 +83,9 @@ function createTestPlugin(params?: {
|
82 | 83 | if (params?.startAccount) { |
83 | 84 | gateway.startAccount = params.startAccount; |
84 | 85 | } |
| 86 | +if (params?.stopAccount) { |
| 87 | +gateway.stopAccount = params.stopAccount; |
| 88 | +} |
85 | 89 | return { |
86 | 90 | id, |
87 | 91 | meta: { |
@@ -273,6 +277,20 @@ describe("server-channels auto restart", () => {
|
273 | 277 | expect(account?.lastError).toBeNull(); |
274 | 278 | }); |
275 | 279 | |
| 280 | +it("does not enumerate configured accounts when stopping a never-started channel", async () => { |
| 281 | +const listAccountIds = vi.fn(() => [DEFAULT_ACCOUNT_ID]); |
| 282 | +const resolveAccount = vi.fn(() => ({ enabled: true, configured: true })); |
| 283 | +const stopAccount = vi.fn(async () => undefined); |
| 284 | +installTestRegistry(createTestPlugin({ listAccountIds, resolveAccount, stopAccount })); |
| 285 | +const manager = createManager(); |
| 286 | + |
| 287 | +await manager.stopChannel("discord"); |
| 288 | + |
| 289 | +expect(listAccountIds).not.toHaveBeenCalled(); |
| 290 | +expect(resolveAccount).not.toHaveBeenCalled(); |
| 291 | +expect(stopAccount).not.toHaveBeenCalled(); |
| 292 | +}); |
| 293 | + |
276 | 294 | it("does not auto-restart after manual stop during backoff", async () => { |
277 | 295 | const startAccount = vi.fn(async () => {}); |
278 | 296 | installTestRegistry( |
|