UNPKG

@apistudio/apim-cli

Version:

CLI for API Management Products

39 lines (32 loc) 1.65 kB
/** * Copyright Super iPaaS Integration LLC, an IBM Company 2024 */ import { spawnSync } from 'node:child_process'; import {BUILD_DESC,TEST_DESC,DEPLOY_DESC} from '../../../src/constants/command-constants.js'; describe('Functional tests for the help command', () => { test('should display basic help information', () => { const result = spawnSync('node', ['dist/cli.cjs', '--help'], { encoding: 'utf-8' }); expect(result.stdout).toContain('Usage: apic [options] [command]'); expect(result.stdout).toContain('Commands:'); }); test('should display basic help information with -h', () => { const result = spawnSync('node', ['dist/cli.cjs', '-h'], { encoding: 'utf-8' }); expect(result.stdout).toContain('Usage: apic [options] [command]'); expect(result.stdout).toContain('Commands:'); }); test('should display help for build command', () => { const result = spawnSync('node', ['dist/cli.cjs', 'help', 'build'], { encoding: 'utf-8' }); expect(result.stdout).toContain('Usage: apic build [options] [projects]'); expect(result.stdout).toContain(BUILD_DESC); }); test('should display help for deploy command', () => { const result = spawnSync('node', ['dist/cli.cjs', 'help', 'deploy'], { encoding: 'utf-8' }); expect(result.stdout).toContain('Usage: apic deploy [options] [projects]'); expect(result.stdout).toContain(DEPLOY_DESC); }); test('should display help for test command', () => { const result = spawnSync('node', ['dist/cli.cjs', 'help', 'test'], { encoding: 'utf-8' }); expect(result.stdout).toContain('Usage: apic test [options] [projects]'); expect(result.stdout).toContain(TEST_DESC); }); });