diff options
Diffstat (limited to 'deps/npm/test/lib/audit.js')
-rw-r--r-- | deps/npm/test/lib/audit.js | 33 |
1 files changed, 10 insertions, 23 deletions
diff --git a/deps/npm/test/lib/audit.js b/deps/npm/test/lib/audit.js index cc7379394b2..3d6296bac64 100644 --- a/deps/npm/test/lib/audit.js +++ b/deps/npm/test/lib/audit.js @@ -168,35 +168,22 @@ t.test('report endpoint error', t => { }) t.test('completion', t => { - t.test('fix', t => { - audit.completion({ - conf: { argv: { remain: ['npm', 'audit'] } }, - }, (err, res) => { - if (err) - throw err - const subcmd = res.pop() - t.equals('fix', subcmd, 'completes to fix') - t.end() - }) + t.test('fix', async t => { + t.resolveMatch(audit.completion({ conf: { argv: { remain: ['npm', 'audit'] } } }), ['fix'], 'completes to fix') + t.end() }) t.test('subcommand fix', t => { - audit.completion({ - conf: { argv: { remain: ['npm', 'audit', 'fix'] } }, - }, (err) => { - if (err) - throw err - t.end() - }) + t.resolveMatch(audit.completion({ conf: { argv: { remain: ['npm', 'audit', 'fix'] } } }), [], 'resolves to ?') + t.end() }) t.test('subcommand not recognized', t => { - audit.completion({ - conf: { argv: { remain: ['npm', 'audit', 'repare'] } }, - }, (err) => { - t.ok(err, 'not recognized') - t.end() - }) + t.rejects( + audit.completion({ conf: { argv: { remain: ['npm', 'audit', 'repare'] } } }), + { message: 'repare not recognized' } + ) + t.end() }) t.end() |