diff options
author | Gar <gar+gh@danger.computer> | 2021-02-23 02:59:21 +0300 |
---|---|---|
committer | Gar <gar+gh@danger.computer> | 2021-02-25 21:23:43 +0300 |
commit | 113b1319f9e9c90694454bebc9dc12111a441ecf (patch) | |
tree | 7dd6bd1e39dd16889c2912f419307c029969b6d1 /test/lib/token.js | |
parent | 881a8558de5cb808c9efdcf3fb5d0a86a95e8eb0 (diff) |
chore(refactor): promisify completion scripts
We also removed the "none" script because we handle a missing
script just fine. There is no need to put an empty one in
PR-URL: https://github.com/npm/cli/pull/2759
Credit: @wraithgar
Close: #2759
Reviewed-by: @nlf
Diffstat (limited to 'test/lib/token.js')
-rw-r--r-- | test/lib/token.js | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/test/lib/token.js b/test/lib/token.js index f98881072..6ab841f49 100644 --- a/test/lib/token.js +++ b/test/lib/token.js @@ -48,27 +48,18 @@ test('completion', (t) => { t.plan(5) const testComp = (argv, expect) => { - tokenMock.completion({ conf: { argv: { remain: argv } } }, (err, res) => { - if (err) - throw err - - t.strictSame(res, expect, argv.join(' ')) - }) + t.resolveMatch(tokenMock.completion({ conf: { argv: { remain: argv } } }), expect, argv.join(' ')) } - testComp(['npm', 'token'], [ - 'list', - 'revoke', - 'create', - ]) - + testComp(['npm', 'token'], ['list', 'revoke', 'create']) testComp(['npm', 'token', 'list'], []) testComp(['npm', 'token', 'revoke'], []) testComp(['npm', 'token', 'create'], []) - tokenMock.completion({ conf: { argv: { remain: ['npm', 'token', 'foobar'] } } }, (err) => { - t.match(err, { message: 'foobar not recognized' }) - }) + t.rejects( + tokenMock.completion({ conf: { argv: { remain: ['npm', 'token', 'foobar'] } } }), + { message: 'foobar not recognize' } + ) }) test('token foobar', (t) => { |