Add a test for CLI commands
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import { spawnSync } from 'child_process';
|
||||
|
||||
describe('Test laconic CLI commands', () => {
|
||||
beforeAll(async () => {
|
||||
// TODO: Install laconic binary (create symlink in path)
|
||||
// TODO: Create a temp directory to run the tests in and cd into that
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
// TODO: Cleanup temp dir
|
||||
});
|
||||
|
||||
test('laconic', async () => {
|
||||
const result = spawnSync('laconic');
|
||||
|
||||
const output = result.stdout.toString().trim();
|
||||
const errorOutput = result.stderr.toString().trim();
|
||||
|
||||
// Expect error with usage string
|
||||
expect(output).toBe('');
|
||||
expect(errorOutput).toContain('laconic <command>');
|
||||
expect(result.status).toBe(1);
|
||||
});
|
||||
|
||||
describe('laconic <command>', () => {
|
||||
// TODO: Test subcommands
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user