mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-16 10:16:49 +00:00
- 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
38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
import { describe, expect, it } from 'bun:test';
|
|
import { parseChannelsCommandArgs } from '../../../src/commands/config-channels-command';
|
|
|
|
describe('config channels command parser', () => {
|
|
it('parses selection, unattended mode, and token input', () => {
|
|
const result = parseChannelsCommandArgs([
|
|
'--set',
|
|
'telegram,discord',
|
|
'--unattended',
|
|
'--set-token',
|
|
'telegram=telegram-secret',
|
|
]);
|
|
|
|
expect(result.setSelection).toBe('telegram,discord');
|
|
expect(result.unattended).toBe(true);
|
|
expect(result.setToken).toEqual({
|
|
channelId: 'telegram',
|
|
token: 'telegram-secret',
|
|
});
|
|
});
|
|
|
|
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).toEqual({ channelId: 'discord', token: 'abc' });
|
|
expect(clearAll.clearTokenAll).toBe(true);
|
|
expect(clearOne.clearTokenChannel).toBe('discord');
|
|
});
|
|
});
|