Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/test/lib/config.js')
-rw-r--r--deps/npm/test/lib/config.js36
1 files changed, 5 insertions, 31 deletions
diff --git a/deps/npm/test/lib/config.js b/deps/npm/test/lib/config.js
index 5d2f54249cf..edaa6486cdc 100644
--- a/deps/npm/test/lib/config.js
+++ b/deps/npm/test/lib/config.js
@@ -610,23 +610,13 @@ t.test('completion', t => {
const { completion } = config
const testComp = (argv, expect) => {
- completion({ conf: { argv: { remain: argv } } }, (er, res) => {
- t.ifError(er)
- t.strictSame(res, expect, argv.join(' '))
- })
+ t.resolveMatch(completion({ conf: { argv: { remain: argv } } }), expect, argv.join(' '))
}
testComp(['npm', 'foo'], [])
- testComp(['npm', 'config'], [
- 'get',
- 'set',
- 'delete',
- 'ls',
- 'rm',
- 'edit',
- 'list',
- ])
+ testComp(['npm', 'config'], ['get', 'set', 'delete', 'ls', 'rm', 'edit', 'list'])
testComp(['npm', 'config', 'set', 'foo'], [])
+
const possibleConfigKeys = [...Object.keys(types)]
testComp(['npm', 'config', 'get'], possibleConfigKeys)
testComp(['npm', 'config', 'set'], possibleConfigKeys)
@@ -636,24 +626,8 @@ t.test('completion', t => {
testComp(['npm', 'config', 'list'], [])
testComp(['npm', 'config', 'ls'], [])
- completion({
- conf: {
- argv: {
- remain: ['npm', 'config'],
- },
- },
- partialWord: 'l',
- }, (er, res) => {
- t.ifError(er)
- t.strictSame(res, [
- 'get',
- 'set',
- 'delete',
- 'ls',
- 'rm',
- 'edit',
- ], 'npm config')
- })
+ const partial = completion({conf: { argv: { remain: ['npm', 'config'] } }, partialWord: 'l'})
+ t.resolveMatch(partial, ['get', 'set', 'delete', 'ls', 'rm', 'edit'], 'npm config')
t.end()
})