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

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGar <gar+gh@danger.computer>2022-03-24 17:18:56 +0300
committerLuke Karrys <luke@lukekarrys.com>2022-03-28 23:21:36 +0300
commitd8dcc02cfd354c1314c45d6530ec926cd138210c (patch)
treeba3721d4c4f153fe005bf9e08d450d9e2473a9a4 /test
parenta64acc0bf01e4bc68b26ead5b2d5c6db47ef16c2 (diff)
fix: consolidate command alias code
Diffstat (limited to 'test')
-rw-r--r--test/lib/npm.js12
-rw-r--r--test/lib/utils/deref-command.js9
2 files changed, 7 insertions, 14 deletions
diff --git a/test/lib/npm.js b/test/lib/npm.js
index 541c1258d..998e96314 100644
--- a/test/lib/npm.js
+++ b/test/lib/npm.js
@@ -548,12 +548,14 @@ t.test('output clears progress and console.logs the message', async t => {
t.end()
})
-t.test('unknown command', async t => {
+t.test('aliases and typos', async t => {
const { npm } = await loadMockNpm(t, { load: false })
- await t.rejects(
- npm.cmd('thisisnotacommand'),
- { code: 'EUNKNOWNCOMMAND' }
- )
+ await t.rejects(npm.cmd('thisisnotacommand'), { code: 'EUNKNOWNCOMMAND' })
+ await t.rejects(npm.cmd(''), { code: 'EUNKNOWNCOMMAND' })
+ await t.rejects(npm.cmd('birt'), { code: 'EUNKNOWNCOMMAND' })
+ await t.resolves(npm.cmd('it'), { name: 'install-test' })
+ await t.resolves(npm.cmd('installTe'), { name: 'install-test' })
+ await t.resolves(npm.cmd('birthday'), { name: 'birthday' })
})
t.test('explicit workspace rejection', async t => {
diff --git a/test/lib/utils/deref-command.js b/test/lib/utils/deref-command.js
deleted file mode 100644
index 474488c58..000000000
--- a/test/lib/utils/deref-command.js
+++ /dev/null
@@ -1,9 +0,0 @@
-const t = require('tap')
-const deref = require('../../../lib/utils/deref-command.js')
-
-t.equal(deref(null), '')
-t.equal(deref(8), '')
-t.equal(deref('it'), 'install-test')
-t.equal(deref('installTe'), 'install-test')
-t.equal(deref('birthday'), 'birthday')
-t.equal(deref('birt'), '')