Files
openclaw/test/e2e/qa-lab/config/cli-channel-picker.test.ts
2026-07-04 10:48:49 -07:00

47 lines
1.5 KiB
TypeScript

// CLI channel picker producer tests cover its unique config and redaction assertions.
import { describe, expect, it } from "vitest";
import { cliChannelPickerTestApi } from "./cli-channel-picker.js";
function validPickerConfig() {
return {
plugins: { entries: { telegram: { enabled: true } } },
channels: {
telegram: {
enabled: true,
botToken: cliChannelPickerTestApi.testBotToken,
groups: { "*": { requireMention: true } },
},
},
wizard: { lastRunCommand: "configure", lastRunMode: "local" },
};
}
describe("CLI channel picker producer", () => {
it("accepts only the expected isolated Telegram configuration", () => {
expect(cliChannelPickerTestApi.assertPickerConfig(validPickerConfig())).toMatchObject({
channelEnabled: true,
defaultGroupRequiresMention: true,
pluginEnabled: true,
selectedChannel: "telegram",
wizardCommand: "configure",
wizardMode: "local",
});
expect(() =>
cliChannelPickerTestApi.assertPickerConfig({
...validPickerConfig(),
channels: { telegram: { enabled: true, botToken: "wrong" } },
}),
).toThrow("entered Telegram bot token");
});
it("removes the synthetic token and ANSI control sequences from evidence", () => {
const sanitized = cliChannelPickerTestApi.sanitizePickerTranscript(
`\u001b[31m${cliChannelPickerTestApi.testBotToken}\u001b[0m`,
);
expect(sanitized).toBe("<test-token>");
expect(sanitized).not.toContain("123456");
});
});