项目文件夹

文件
wehub-resource-sync 98e40dac97
CLI Smoke Test / smoke-test-linux (20) (push) Has been cancelled
CLI Smoke Test / smoke-test-linux (24) (push) Has been cancelled
CLI Smoke Test / smoke-test-windows (20) (push) Has been cancelled
CLI Smoke Test / smoke-test-windows (24) (push) Has been cancelled
Expo App TypeScript typecheck / typecheck (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:40:49 +08:00

24 行
904 B
TypeScript

import { describe, expect, it } from 'vitest';
import { stringifyToolCommand } from './toolCommand';
describe('stringifyToolCommand', () => {
it('returns plain string commands unchanged', () => {
expect(stringifyToolCommand('ls -la')).toBe('ls -la');
});
it('unwraps shell wrapper command arrays', () => {
expect(stringifyToolCommand(['/bin/zsh', '-lc', 'rg -n "test" .'])).toBe('rg -n "test" .');
expect(stringifyToolCommand(['bash', '-c', 'pwd'])).toBe('pwd');
});
it('joins non-wrapper command arrays', () => {
expect(stringifyToolCommand(['git', 'status', '--short'])).toBe('git status --short');
});
it('returns null for empty or unsupported values', () => {
expect(stringifyToolCommand(' ')).toBeNull();
expect(stringifyToolCommand([])).toBeNull();
expect(stringifyToolCommand(null)).toBeNull();
});
});