Skip to content

Commit

Permalink
test: add test for parsing big numbers
Browse files Browse the repository at this point in the history
Closes: #154
  • Loading branch information
thetutlage committed Dec 19, 2023
1 parent 6d91b18 commit 7888c7e
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/parser.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,28 @@ test.group('Parser | flags', () => {
},
})
})

test('parse big numbers', ({ assert }) => {
class MakeModel extends BaseCommand {}
MakeModel.defineFlag('connection', { type: 'string' })
MakeModel.defineFlag('batchSize', { type: 'number' })

assert.deepEqual(
new Parser(MakeModel.getParserOptions()).parse(
'--connection=111111111111111111111111 --batch-size=111111111111111111111111'
),
{
_: [],
nodeArgs: [],
args: [],
unknownFlags: [],
flags: {
'batch-size': 1.1111111111111111e23, // converted to number
'connection': '111111111111111111111111', // reatains string value
},
}
)
})
})

test.group('Parser | arguments', () => {
Expand Down

0 comments on commit 7888c7e

Please sign in to comment.