Skip to content

Commit

Permalink
test: add tests for #95 (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniom authored and bcoe committed Dec 20, 2017
1 parent 3571f57 commit 9f2b662
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/yargs-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -1220,6 +1220,18 @@ describe('yargs-parser', function () {
result.should.have.property('some-option').that.is.a('string').and.equals('val')
result.should.have.property('someOption').that.is.a('string').and.equals('val')
})

// https://github.com/yargs/yargs-parser/issues/95
it('should not duplicate option values when equivalent dashed aliases are provided', function () {
var result = parser(['--someOption', 'val'], {
alias: {
someOption: 'some-option'
}
})

result.should.have.property('some-option').that.is.a('string').and.equals('val')
result.should.have.property('someOption').that.is.a('string').and.equals('val')
})
}

describe('dashes and camelCase', function () {
Expand Down Expand Up @@ -1497,6 +1509,11 @@ describe('yargs-parser', function () {
result['1'][0].should.equal('a')
result['1'][1].should.equal('b')
})

it('should create an array when passing an argument twice with same value', function () {
var result = parser(['-x', 'val1', '-x', 'val1'])
result.should.have.property('x').that.is.an('array').and.to.deep.equal(['val1', 'val1'])
})
})

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

0 comments on commit 9f2b662

Please sign in to comment.