feat(cli): add plain/no-emoji/no-color + help
This commit is contained in:
+12
-1
@@ -2,7 +2,18 @@ import { describe, expect, it } from 'vitest';
|
||||
import { looksLikeTweetInput, resolveCliInvocation } from '../src/lib/cli-args.js';
|
||||
|
||||
describe('cli-args', () => {
|
||||
const known = new Set(['tweet', 'reply', 'read', 'replies', 'thread', 'search', 'mentions', 'whoami', 'check']);
|
||||
const known = new Set([
|
||||
'tweet',
|
||||
'reply',
|
||||
'read',
|
||||
'replies',
|
||||
'thread',
|
||||
'search',
|
||||
'mentions',
|
||||
'help',
|
||||
'whoami',
|
||||
'check',
|
||||
]);
|
||||
|
||||
it('detects tweet URLs', () => {
|
||||
expect(looksLikeTweetInput('https://x.com/user/status/1234567890')).toBe(true);
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { labelPrefix, resolveOutputConfigFromArgv, statusPrefix } from '../src/lib/output.js';
|
||||
|
||||
describe('output', () => {
|
||||
it('plain disables emoji + color', () => {
|
||||
const cfg = resolveOutputConfigFromArgv(['--plain'], {}, true);
|
||||
expect(cfg).toEqual({ plain: true, emoji: false, color: false });
|
||||
expect(statusPrefix('ok', cfg)).toBe('[ok] ');
|
||||
expect(labelPrefix('url', cfg)).toBe('url: ');
|
||||
});
|
||||
|
||||
it('NO_COLOR disables colors by default', () => {
|
||||
const cfg = resolveOutputConfigFromArgv([], { NO_COLOR: '1' }, true);
|
||||
expect(cfg.color).toBe(false);
|
||||
});
|
||||
|
||||
it('--no-emoji switches to text prefixes', () => {
|
||||
const cfg = resolveOutputConfigFromArgv(['--no-emoji'], {}, true);
|
||||
expect(cfg.emoji).toBe(false);
|
||||
expect(statusPrefix('warn', cfg)).toBe('Warning: ');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user