Add a test for CLI commands

This commit is contained in:
2024-01-24 12:21:43 +05:30
parent 5a0298dda5
commit 821172f8ea
5 changed files with 2026 additions and 7 deletions
+28
View File
@@ -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
});
});