UNPKG

sda

Version:

Software development assistant

41 lines 1.62 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const Log_1 = __importDefault(require("../Log")); const getParams_1 = __importDefault(require("./getParams")); beforeAll(() => { Log_1.default.isEnabled = false; }); test('returns empty array when empty args array passed', () => { const args = []; const result = getParams_1.default(args); expect(result).toEqual([]); }); test('recognizes params starting with -', () => { const args = ['arg1', 'arg2', '-param']; const result = getParams_1.default(args); expect(result).toEqual([['-param']]); }); test('recognizes params starting with /', () => { const args = ['arg1', 'arg2', '/p']; const result = getParams_1.default(args); expect(result).toEqual([['/p']]); }); test('recognizes multiple params', () => { const args = ['arg1', 'arg2', '-param', '/p']; const result = getParams_1.default(args); expect(result).toEqual([['-param'], ['/p']]); }); test('groups params with values', () => { const args = ['arg1', 'arg2', '-param', 'paramValue', '-a']; const result = getParams_1.default(args); expect(result).toEqual([['-param', 'paramValue'], ['-a']]); }); test('removes params from args list', () => { const args = ['arg1', 'arg2', 'arg3', '-param', 'paramValue']; getParams_1.default(args); expect(args).toEqual(['arg1', 'arg2', 'arg3']); }); //# sourceMappingURL=getParams.test.js.map