-
Notifications
You must be signed in to change notification settings - Fork 991
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
For "--some-option", also set argv.someOption
- Loading branch information
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
var should = require('chai').should(), | ||
yargs = require('../'); | ||
|
||
describe('parse', function () { | ||
|
||
describe('dashes and camelCase', function () { | ||
|
||
it('should provide options with dashes as camelCase properties', function () { | ||
var result = yargs() | ||
.option('some-option', { | ||
alias : 'o', | ||
describe : 'some option' | ||
}) | ||
.parse([ '--some-option' ]); | ||
|
||
result.should.have.property('someOption').that.is.a('boolean').and.is.true; | ||
}); | ||
|
||
it('should provide aliases with dashes as camelCase properties', function() { | ||
var result = yargs() | ||
.option('o', { | ||
alias : 'some-option', | ||
describe : 'some option' | ||
}) | ||
.parse([ '--some-option', 'val' ]); | ||
|
||
result.should.have.property('someOption').that.is.a('string').and.equals('val'); | ||
}); | ||
}); | ||
|
||
}); |