mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-18 14:13:21 +00:00
feat(channels): support telegram and imessage
- replace the Discord-only config with multi-channel official channels selection - add Telegram token handling and iMessage platform-aware runtime gating - expand CLI, dashboard, and tests for Telegram, Discord, and iMessage Refs #783
This commit is contained in:
1 parent
4bce1559dd
commit
6f1f032c63
19 files changed
+1416
-725
No files matched your search
@@ -2,26 +2,36 @@ import { describe, expect, it } from 'bun:test';
|
||||
import { parseChannelsCommandArgs } from '../../../src/commands/config-channels-command';
|
||||
|
||||
describe('config channels command parser', () => {
|
||||
it('parses toggles and token input', () => {
|
||||
it('parses selection, unattended mode, and token input', () => {
|
||||
const result = parseChannelsCommandArgs([
|
||||
'--enable',
|
||||
'--set',
|
||||
'telegram,discord',
|
||||
'--unattended',
|
||||
'--set-token',
|
||||
'discord-secret',
|
||||
'telegram=telegram-secret',
|
||||
]);
|
||||
|
||||
expect(result.enable).toBe(true);
|
||||
expect(result.setSelection).toBe('telegram,discord');
|
||||
expect(result.unattended).toBe(true);
|
||||
expect(result.setToken).toBe('discord-secret');
|
||||
expect(result.setToken).toEqual({
|
||||
channelId: 'telegram',
|
||||
token: 'telegram-secret',
|
||||
});
|
||||
});
|
||||
|
||||
it('supports inline token assignment and clear flags', () => {
|
||||
const result = parseChannelsCommandArgs(['--disable', '--no-unattended', '--set-token=abc']);
|
||||
const clearResult = parseChannelsCommandArgs(['--clear-token']);
|
||||
it('supports inline token assignment, legacy flags, and clear-token variants', () => {
|
||||
const result = parseChannelsCommandArgs([
|
||||
'--disable',
|
||||
'--no-unattended',
|
||||
'--set-token=abc',
|
||||
]);
|
||||
const clearAll = parseChannelsCommandArgs(['--clear-token']);
|
||||
const clearOne = parseChannelsCommandArgs(['--clear-token', 'discord']);
|
||||
|
||||
expect(result.disable).toBe(true);
|
||||
expect(result.noUnattended).toBe(true);
|
||||
expect(result.setToken).toBe('abc');
|
||||
expect(clearResult.clearToken).toBe(true);
|
||||
expect(result.setToken).toEqual({ channelId: 'discord', token: 'abc' });
|
||||
expect(clearAll.clearTokenAll).toBe(true);
|
||||
expect(clearOne.clearTokenChannel).toBe('discord');
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user