1 | 'use strict'
|
2 | const TestRunner = require('test-runner')
|
3 | const commandLineArgs = require('../')
|
4 | const a = require('assert')
|
5 |
|
6 | const definitions = [
|
7 | { name: 'one', type: String }
|
8 | ]
|
9 |
|
10 | const runner = new TestRunner()
|
11 |
|
12 | runner.test('type-string: different values', function () {
|
13 | a.deepStrictEqual(
|
14 | commandLineArgs(definitions, { argv: [ '--one', 'yeah' ] }),
|
15 | { one: 'yeah' }
|
16 | )
|
17 | a.deepStrictEqual(
|
18 | commandLineArgs(definitions, { argv: [ '--one' ] }),
|
19 | { one: null }
|
20 | )
|
21 | a.deepStrictEqual(
|
22 | commandLineArgs(definitions, { argv: [ '--one', '3' ] }),
|
23 | { one: '3' }
|
24 | )
|
25 | })
|