20 lines
713 B
TypeScript
20 lines
713 B
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { formatConfig } from './config-cmd.js';
|
|
|
|
describe('config command', () => {
|
|
it('formats config as indented JSON with redacted secrets', () => {
|
|
const config = {
|
|
telegram: { bot_token: 'secret-123', allowed_chat_ids: [123] },
|
|
models: { default: { provider: 'anthropic', model: 'claude', api_key: 'sk-abc' } },
|
|
server: { port: 18800 },
|
|
};
|
|
|
|
const output = formatConfig(config);
|
|
expect(output).toContain('"bot_token": "***"');
|
|
expect(output).toContain('"api_key": "***"');
|
|
expect(output).toContain('"port": 18800');
|
|
expect(output).not.toContain('secret-123');
|
|
expect(output).not.toContain('sk-abc');
|
|
});
|
|
});
|