summaryrefslogtreecommitdiff
path: root/deps/npm/test/lib/profile.js
diff options
context:
space:
mode:
authorRuy Adorno <ruyadorno@hotmail.com>2021-03-01 11:38:43 -0500
committerMichaël Zasso <targos@protonmail.com>2021-03-02 09:31:29 +0100
commit993963e2ee1c24dee0f39dbdbb3283272c30679c (patch)
tree7ad138c8a4b240f948e322eb2bc5c6d7acca32e6 /deps/npm/test/lib/profile.js
parentb3f35e2c70c7d1e3ee7b4c3fd74672adceb16c52 (diff)
downloadnode-new-993963e2ee1c24dee0f39dbdbb3283272c30679c.tar.gz
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/profile.js')
-rw-r--r--deps/npm/test/lib/profile.js47
1 files changed, 18 insertions, 29 deletions
diff --git a/deps/npm/test/lib/profile.js b/deps/npm/test/lib/profile.js
index 48a558cace..3b2e140036 100644
--- a/deps/npm/test/lib/profile.js
+++ b/deps/npm/test/lib/profile.js
@@ -1398,17 +1398,16 @@ t.test('unknown subcommand', t => {
t.test('completion', t => {
const { completion } = profile
- const testComp = ({ t, argv, expect, title }) => {
- completion({ conf: { argv: { remain: argv } } }, (err, res) => {
- if (err)
- throw err
-
- t.strictSame(res, expect, title)
- })
+ const testComp = async ({ t, argv, expect, title }) => {
+ t.resolveMatch(
+ completion({ conf: { argv: { remain: argv } } }),
+ expect,
+ title
+ )
}
- t.test('npm profile autocomplete', t => {
- testComp({
+ t.test('npm profile autocomplete', async t => {
+ await testComp({
t,
argv: ['npm', 'profile'],
expect: ['enable-2fa', 'disable-2fa', 'get', 'set'],
@@ -1418,8 +1417,8 @@ t.test('completion', t => {
t.end()
})
- t.test('npm profile enable autocomplete', t => {
- testComp({
+ t.test('npm profile enable autocomplete', async t => {
+ await testComp({
t,
argv: ['npm', 'profile', 'enable-2fa'],
expect: ['auth-and-writes', 'auth-only'],
@@ -1429,10 +1428,10 @@ t.test('completion', t => {
t.end()
})
- t.test('npm profile <subcmd> no autocomplete', t => {
+ t.test('npm profile <subcmd> no autocomplete', async t => {
const noAutocompleteCmds = ['disable-2fa', 'disable-tfa', 'get', 'set']
for (const subcmd of noAutocompleteCmds) {
- testComp({
+ await testComp({
t,
argv: ['npm', 'profile', subcmd],
expect: [],
@@ -1443,22 +1442,12 @@ t.test('completion', t => {
t.end()
})
- t.test('npm profile unknown subcommand autocomplete', t => {
- completion({
- conf: {
- argv: {
- remain: ['npm', 'profile', 'asdf'],
- },
- },
- }, (err, res) => {
- t.match(
- err,
- /asdf not recognized/,
- 'should throw unknown cmd error'
- )
-
- t.end()
- })
+ t.test('npm profile unknown subcommand autocomplete', async t => {
+ t.rejects(
+ completion({ conf: { argv: { remain: ['npm', 'profile', 'asdf'] } } }),
+ { message: 'asdf not recognized' }, 'should throw unknown cmd error'
+ )
+ t.end()
})
t.end()