-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
119 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,30 @@ | ||
const { exec } = require('child_process'); | ||
const { execSync } = require('child_process'); | ||
const path = require('path'); | ||
|
||
const pathToBin = path.resolve(__dirname, '../bin/bbob') | ||
const pathToBin = path.resolve(__dirname, '../bin/bbob.js') | ||
|
||
describe('@bbob/cli', () => { | ||
console.log('pathToBin', pathToBin) | ||
test('simple string', (done) => { | ||
exec(`echo "hello" | ${pathToBin}`, (error, stdout, stderr) => { | ||
if (error) { | ||
done(error); | ||
return; | ||
} | ||
expect(stdout.trim()).toBe('olleh'); | ||
done(); | ||
}); | ||
test('simple string', () => { | ||
const stdout = execSync(`echo "hello" | ${pathToBin}`); | ||
|
||
expect(String(stdout).trim()).toBe('hello'); | ||
}); | ||
|
||
test('string with bbcodes', (done) => { | ||
exec(`echo "[i]Text[/i]" | ${pathToBin}`, (error, stdout, stderr) => { | ||
if (error) { | ||
done(error); | ||
return; | ||
} | ||
expect(stdout.trim()).toBe('<span style="font-style: italic;">Text</span>'); | ||
done(); | ||
}); | ||
test('string with bbcodes', () => { | ||
const stdout = execSync(`echo "[i]Text[/i]" | ${pathToBin}`); | ||
|
||
expect(String(stdout).trim()).toBe('<span style="font-style: italic;">Text</span>'); | ||
}); | ||
|
||
test('empty string', (done) => { | ||
exec(`echo "" | ${pathToBin}`, (error, stdout, stderr) => { | ||
if (error) { | ||
done(error); | ||
return; | ||
} | ||
expect(stdout.trim()).toBe(''); | ||
done(); | ||
}); | ||
test('empty string', () => { | ||
const stdout = execSync(`echo "" | ${pathToBin}`); | ||
|
||
expect(String(stdout).trim()).toBe(''); | ||
}); | ||
|
||
test('multiline string', (done) => { | ||
exec(`echo -e "[i]Text[/i]\n[i]Text[/i]" | ${pathToBin}`, (error, stdout, stderr) => { | ||
if (error) { | ||
done(error); | ||
return; | ||
} | ||
expect(stdout.trim()).toBe('<span style="font-style: italic;">Text</span>\n<span style="font-style: italic;">Text</span>'); | ||
done(); | ||
}); | ||
test('multiline string', () => { | ||
const stdout = execSync(`echo "[i]Text[/i]\n[i]Text[/i]" | ${pathToBin}`); | ||
|
||
expect(String(stdout).trim()).toBe('<span style="font-style: italic;">Text</span>\n<span style="font-style: italic;">Text</span>'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters