Skip to content

Commit c909121

Browse files
committed
test more than just numeric and boolean arguments
1 parent b97e0e9 commit c909121

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

test/yargs-parser.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2703,29 +2703,29 @@ describe('yargs-parser', function () {
27032703
})
27042704
})
27052705
it('should ignore unknown options in long format separated by space', function () {
2706-
const argv = parser('--known-arg 1 --unknown-arg 2', {
2707-
number: ['known-arg'],
2706+
const argv = parser('--known-arg a --unknown-arg b', {
2707+
string: ['known-arg'],
27082708
configuration: {
27092709
'parse-unknown-options': false
27102710
}
27112711
})
27122712
argv.should.deep.equal({
2713-
_: ['--unknown-arg', 2],
2714-
'known-arg': 1,
2715-
'knownArg': 1
2713+
_: ['--unknown-arg', 'b'],
2714+
'known-arg': 'a',
2715+
'knownArg': 'a'
27162716
})
27172717
})
27182718
it('should ignore unknown options in short dot format separated by equals', function () {
2719-
const argv = parser('-k.arg=1 -u.arg=2', {
2720-
number: ['k.arg'],
2719+
const argv = parser('-k.arg=a -u.arg=b', {
2720+
string: ['k.arg'],
27212721
configuration: {
27222722
'parse-unknown-options': false
27232723
}
27242724
})
27252725
argv.should.deep.equal({
2726-
_: ['-u.arg=2'],
2726+
_: ['-u.arg=b'],
27272727
'k': {
2728-
'arg': 1
2728+
'arg': 'a'
27292729
}
27302730
})
27312731
})
@@ -2744,15 +2744,15 @@ describe('yargs-parser', function () {
27442744
})
27452745
})
27462746
it('should ignore unknown options in short format separated by equals', function () {
2747-
const argv = parser('-k=1 -u=2', {
2748-
number: ['k'],
2747+
const argv = parser('-k=a -u=b', {
2748+
string: ['k'],
27492749
configuration: {
27502750
'parse-unknown-options': false
27512751
}
27522752
})
27532753
argv.should.deep.equal({
2754-
_: ['-u=2'],
2755-
'k': 1
2754+
_: ['-u=b'],
2755+
'k': 'a'
27562756
})
27572757
})
27582758
it('should ignore unknown options in short format followed by hyphen', function () {

0 commit comments

Comments
 (0)