Skip to content

Commit

Permalink
Add assign to spec test, reorder spec normalize props
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnesfield committed Mar 29, 2024
1 parent 2693aac commit 7daba9b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/core/spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ function normalize(options: SpecOptions | undefined) {
const props: (keyof SpecOptions)[] = [
'id',
'name',
'assign',
'min',
'max',
'maxRead',
'assign',
'validate'
];
for (const prop of props) {
Expand Down
7 changes: 4 additions & 3 deletions test/spec.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('spec', () => {
.alias(`--no-${bool}`, '0');
}
cmd
.option('--baz', { max: 2, maxRead: 0 })
.option('--baz', { max: 2, maxRead: 0, assign: false })
.alias('-ba')
.alias('--no-baz', '0');
// setup detailed aliases
Expand All @@ -75,7 +75,7 @@ describe('spec', () => {
.spec(endSpec)
.spec(commandSpec)
// foo
.command('bar', { min: 1 })
.command('bar', { min: 1, assign: true })
.alias('b')
.spec(endSpec)
.spec(commandSpec);
Expand All @@ -86,14 +86,15 @@ describe('spec', () => {
args: {
'--foo': { maxRead: 0 },
'--bar': { maxRead: 0 },
'--baz': { max: 2, maxRead: 0 },
'--baz': { max: 2, maxRead: 0, assign: false },
foo: {
min: 1,
args: { '--': { args: {} }, '--help': { maxRead: 0 } },
alias: { '-h': '--help' }
},
bar: {
min: 1,
assign: true,
args: { '--': { args: {} }, '--help': { maxRead: 0 } },
alias: { '-h': '--help' }
},
Expand Down

0 comments on commit 7daba9b

Please sign in to comment.