const { execSync } = require('child_process');
const path = require('path');
const pathToBin = path.resolve(__dirname, '../lib/cli.js')
describe('@bbob/cli', () => {
test('simple string', () => {
const stdout = execSync(`echo "hello" | ${pathToBin}`);
expect(String(stdout).trim()).toBe('hello');
});
test('string with bbcodes', () => {
const stdout = execSync(`echo "[i]Text[/i]" | ${pathToBin}`);
expect(String(stdout).trim()).toBe('Text');
});
test('empty string', () => {
const stdout = execSync(`echo "" | ${pathToBin}`);
expect(String(stdout).trim()).toBe('');
});
test('multiline string', () => {
const stdout = execSync(`echo "[i]Text[/i]\n[i]Text[/i]" | ${pathToBin}`);
expect(String(stdout).trim()).toBe('Text\nText');
});
});