Skip to content

Commit 2994450

Browse files
committed
test(channels): guard resolved account id in empty-map regression
1 parent 27f4c13 commit 2994450

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎src/channels/plugins/setup-wizard.test.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,14 +244,18 @@ describe("channel setup wizard account scoping", () => {
244244
options: { secretInputMode: "plaintext" as const },
245245
});
246246

247+
const accountId = result.accountId;
248+
if (!accountId) {
249+
throw new Error("expected the wizard to resolve an account id");
250+
}
247251
const channel = getChannelConfig(result.cfg);
248252
expect(channel).not.toHaveProperty("botId");
249253
expect(channel).not.toHaveProperty("secret");
250-
expect(channel.accounts?.[result.accountId]).toEqual({
254+
expect(channel.accounts?.[accountId]).toEqual({
251255
botId: "test-new-bot-id",
252256
secret: "mock-secret",
253257
});
254-
expect(Object.keys(channel.accounts ?? {})).toEqual([result.accountId]);
258+
expect(Object.keys(channel.accounts ?? {})).toEqual([accountId]);
255259
});
256260

257261
it("replaces credentials only in the selected existing account after rejecting keep", async () => {

0 commit comments

Comments
 (0)