From 6da34871e52098b4b49175ac75571944c802d2eb Mon Sep 17 00:00:00 2001 From: juergba Date: Wed, 17 Jul 2019 14:50:13 +0200 Subject: [PATCH] extend existing test --- test/yargs-parser.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/test/yargs-parser.js b/test/yargs-parser.js index 773cfe32..d5532ace 100644 --- a/test/yargs-parser.js +++ b/test/yargs-parser.js @@ -194,15 +194,17 @@ describe('yargs-parser', function () { parse.should.have.property('_').and.deep.equal(['aaatrueaaa', 'moo', 'aaafalseaaa']) }) - it('should not use next value for boolean configured with zero narg', function () { - var parse = parser(['--all', 'false'], { - boolean: ['all'], - narg: { - all: 0 - } - }) - parse.should.have.property('all', true).and.be.a('boolean') - parse.should.have.property('_').and.deep.equal(['false']) + it('should not use next value for boolean/number/string configured with zero narg', function () { + var parse = parser(['--bool', 'false', '--nr', '7', '--str', 'foo'], { + boolean: ['bool'], + number: ['nr'], + string: ['str'], + narg: { bool: 0, nr: 0, str: 0 } + }) + parse.should.have.property('bool', true).and.be.a('boolean') + parse.should.have.property('nr', undefined).and.be.a('undefined') + parse.should.have.property('str', '').and.be.a('string') + parse.should.have.property('_').and.deep.equal(['false', 7, 'foo']) }) it('should allow defining options as boolean in groups', function () {