|
| 1 | +import { describe, expect, it } from 'vitest'; |
| 2 | + |
| 3 | +import { getTopLevelCommand, isUpdateCommand } from '../../src/core/cliArgs.js'; |
| 4 | + |
| 5 | +describe('cliArgs', () => { |
| 6 | + describe('getTopLevelCommand', () => { |
| 7 | + it.each([ |
| 8 | + [['node', 'ensemble', 'update'], 'update'], |
| 9 | + [['node', 'ensemble', '--debug', 'update'], 'update'], |
| 10 | + [['node', 'ensemble', 'push'], 'push'], |
| 11 | + [['node', 'ensemble', '--debug', 'push', '--app', 'uat'], 'push'], |
| 12 | + [['node', 'ensemble'], undefined], |
| 13 | + ])('parses %j', (argv, expected) => { |
| 14 | + expect(getTopLevelCommand(argv)).toBe(expected); |
| 15 | + }); |
| 16 | + }); |
| 17 | + |
| 18 | + describe('isUpdateCommand', () => { |
| 19 | + it.each([ |
| 20 | + [['node', 'ensemble', 'update'], true], |
| 21 | + [['node', 'ensemble', '--debug', 'update'], true], |
| 22 | + [['node', 'ensemble', 'push'], false], |
| 23 | + [['node', 'ensemble', 'release', 'create'], false], |
| 24 | + ])('detects update command in %j', (argv, expected) => { |
| 25 | + expect(isUpdateCommand(argv)).toBe(expected); |
| 26 | + }); |
| 27 | + }); |
| 28 | +}); |
0 commit comments