|
| 1 | +import { describe, it, expect } from 'vitest'; |
| 2 | +import { execa } from 'execa'; |
| 3 | + |
| 4 | +describe('cli smoke', () => { |
| 5 | + it('prints help and exits 0', async () => { |
| 6 | + const { stdout, exitCode } = await execa('node', [__CLI_BIN__, '--help']); |
| 7 | + expect(exitCode).toBe(0); |
| 8 | + expect(stdout.toLowerCase()).toContain('usage'); |
| 9 | + }); |
| 10 | + |
| 11 | + it('prints version and exits 0', async () => { |
| 12 | + const { stdout, exitCode } = await execa('node', [__CLI_BIN__, '--version']); |
| 13 | + expect(exitCode).toBe(0); |
| 14 | + expect(stdout).toMatch(/\d+\.\d+\.\d+/); // version pattern |
| 15 | + }); |
| 16 | + |
| 17 | + it('shows info command output', async () => { |
| 18 | + const { stdout, exitCode } = await execa('node', [__CLI_BIN__, 'info']); |
| 19 | + expect(exitCode).toBe(0); |
| 20 | + expect(stdout).toContain('Aignostics Platform SDK'); |
| 21 | + expect(stdout).toContain('Version'); |
| 22 | + }); |
| 23 | + |
| 24 | + it('requires authentication for API commands', async () => { |
| 25 | + // This should fail with authentication error since we're not logged in |
| 26 | + const { exitCode } = await execa('node', [__CLI_BIN__, 'list-applications'], { reject: false }); |
| 27 | + expect(exitCode).toBe(1); // Should exit with error code due to auth |
| 28 | + }); |
| 29 | +}); |
0 commit comments