diff options
author | Ruy Adorno <ruyadorno@hotmail.com> | 2021-03-01 19:38:43 +0300 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2021-03-02 16:08:55 +0300 |
commit | f3d67000a0a6bdce5cbb9ad506a008e5d709bb71 (patch) | |
tree | 650f0737f1d7676f374b523f27bf9b26bb70bb00 /deps/npm/test/lib/access.js | |
parent | 725d48ae777ec23e915370019a60a835a2569711 (diff) |
deps: upgrade npm to 7.6.0
PR-URL: https://github.com/nodejs/node/pull/37559
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Diffstat (limited to 'deps/npm/test/lib/access.js')
-rw-r--r-- | deps/npm/test/lib/access.js | 45 |
1 files changed, 10 insertions, 35 deletions
diff --git a/deps/npm/test/lib/access.js b/deps/npm/test/lib/access.js index 3063b6c5326..fb799f2df29 100644 --- a/deps/npm/test/lib/access.js +++ b/deps/npm/test/lib/access.js @@ -1,35 +1,24 @@ const { test } = require('tap') const requireInject = require('require-inject') -const emptyMock = requireInject('../../lib/access.js', { +const access = requireInject('../../lib/access.js', { '../../lib/npm.js': { flatOptions: {}, }, }) test('completion', t => { - const { completion } = emptyMock + const { completion } = access const testComp = (argv, expect) => { - completion({conf: {argv: {remain: argv}}}, (er, res) => { - if (er) - throw er - t.strictSame(res, expect, argv.join(' ')) - }) + const res = completion({conf: {argv: {remain: argv}}}) + t.resolves(res, expect, argv.join(' ')) } testComp(['npm', 'access'], [ - 'public', - 'restricted', - 'grant', - 'revoke', - 'ls-packages', - 'ls-collaborators', - 'edit', - '2fa-required', - '2fa-not-required', + 'public', 'restricted', 'grant', 'revoke', 'ls-packages', + 'ls-collaborators', 'edit', '2fa-required', '2fa-not-required', ]) - testComp(['npm', 'access', 'grant'], ['read-only', 'read-write']) testComp(['npm', 'access', 'grant', 'read-only'], []) testComp(['npm', 'access', 'public'], []) @@ -42,15 +31,15 @@ test('completion', t => { testComp(['npm', 'access', '2fa-not-required'], []) testComp(['npm', 'access', 'revoke'], []) - completion({conf: {argv: {remain: ['npm', 'access', 'foobar']}}}, (er) => { - t.match(er, { message: 'foobar not recognized' }) - }) + t.rejects( + completion({conf: {argv: {remain: ['npm', 'access', 'foobar']}}}), + { message: 'foobar not recognized' } + ) t.end() }) test('subcommand required', t => { - const access = emptyMock access([], (err) => { t.equal(err, '\nUsage: Subcommand is required.\n\n' + access.usage) t.end() @@ -58,8 +47,6 @@ test('subcommand required', t => { }) test('unrecognized subcommand', (t) => { - const access = emptyMock - access(['blerg'], (err) => { t.match( err, @@ -71,8 +58,6 @@ test('unrecognized subcommand', (t) => { }) test('edit', (t) => { - const access = emptyMock - access([ 'edit', '@scoped/another', @@ -349,8 +334,6 @@ test('access grant current cwd', (t) => { }) test('access grant others', (t) => { - const access = emptyMock - access([ 'grant', 'rerere', @@ -367,8 +350,6 @@ test('access grant others', (t) => { }) test('access grant missing team args', (t) => { - const access = emptyMock - access([ 'grant', 'read-only', @@ -385,8 +366,6 @@ test('access grant missing team args', (t) => { }) test('access grant malformed team arg', (t) => { - const access = emptyMock - access([ 'grant', 'read-only', @@ -452,8 +431,6 @@ test('access revoke', (t) => { }) test('access revoke missing team args', (t) => { - const access = emptyMock - access([ 'revoke', undefined, @@ -469,8 +446,6 @@ test('access revoke missing team args', (t) => { }) test('access revoke malformed team arg', (t) => { - const access = emptyMock - access([ 'revoke', 'foo', |