mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 20:08:26 +00:00
Fix Telegram token resolution for non-normalized accountId keys
This commit is contained in:
@@ -70,4 +70,22 @@ describe("resolveTelegramToken", () => {
|
||||
expect(res.source).toBe("none");
|
||||
fs.rmSync(dir, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
it("resolves per-account tokens when the config account key casing doesn't match routing normalization", () => {
|
||||
vi.stubEnv("TELEGRAM_BOT_TOKEN", "");
|
||||
const cfg = {
|
||||
channels: {
|
||||
telegram: {
|
||||
accounts: {
|
||||
// Note the mixed-case key; runtime accountId is normalized.
|
||||
careyNotifications: { botToken: "acct-token" },
|
||||
},
|
||||
},
|
||||
},
|
||||
} as OpenClawConfig;
|
||||
|
||||
const res = resolveTelegramToken(cfg, { accountId: "careynotifications" });
|
||||
expect(res.token).toBe("acct-token");
|
||||
expect(res.source).toBe("config");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user