UNPKG

589 BJavaScriptView Raw
1'use strict'
2const TestRunner = require('test-runner')
3const commandLineArgs = require('../')
4const a = require('assert')
5
6const definitions = [
7 { name: 'one', type: String }
8]
9
10const runner = new TestRunner()
11
12runner.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})