Skip to content

Commit

Permalink
additional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
juergba committed Oct 29, 2019
1 parent 14b8fc9 commit a40322b
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/yargs-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -1215,6 +1215,26 @@ describe('yargs-parser', function () {
parse.should.have.property('t', false).and.be.a('boolean')
parse.should.have.property('_').and.deep.equal(['moo'])
})

it('should log defaulted options - not specified by user', function () {
var parsed = parser.detailed('', {
default: { foo: 'abc', 'bar.prop': 33 }
})
parsed.argv.foo.should.equal('abc')
parsed.argv.bar.prop.should.equal(33)
parsed.defaulted.foo.should.equal(true)
parsed.defaulted['bar.prop'].should.equal(true)
})

it('should not log defaulted options - specified without value', function () {
var parsed = parser.detailed('--foo --bar.prop', {
default: { foo: 'abc', 'bar.prop': 33 }
})
parsed.argv.foo.should.equal('abc')
parsed.argv.bar.prop.should.equal(33)
parsed.defaulted.should.not.have.property('foo')
parsed.defaulted.should.not.have.property('bar.prop')
})
})

describe('camelCase', function () {
Expand Down

0 comments on commit a40322b

Please sign in to comment.