UNPKG

933 BJavaScriptView Raw
1'use strict'
2const TestRunner = require('test-runner')
3const commandLineArgs = require('../')
4const a = require('assert')
5
6const runner = new TestRunner()
7
8runner.test('multiple: string unset', function () {
9 const argv = []
10 const optionDefinitions = [
11 { name: 'one', multiple: true }
12 ]
13 const result = commandLineArgs(optionDefinitions, { argv })
14 a.deepStrictEqual(result, { })
15})
16
17runner.test('multiple: string unset with defaultValue', function () {
18 const argv = []
19 const optionDefinitions = [
20 { name: 'one', multiple: true, defaultValue: 1 }
21 ]
22 const result = commandLineArgs(optionDefinitions, { argv })
23 a.deepStrictEqual(result, { one: [ 1 ]})
24})
25
26runner.test('multiple: boolean unset', function () {
27 const argv = []
28 const optionDefinitions = [
29 { name: 'one', type: Boolean, multiple: true }
30 ]
31 const result = commandLineArgs(optionDefinitions, { argv })
32 a.deepStrictEqual(result, { })
33})