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:
authornlf <quitlahok@gmail.com>2020-12-14 19:47:25 +0300
committernlf <quitlahok@gmail.com>2020-12-15 22:16:37 +0300
commitd6817f062e62d987c729a12770e0346a9a9d561b (patch)
treead59a4f4f8d2de6f01868349e865e58fe5dfbb9e /test
parenta9c4b158c46dd0d0c8d8744a97750ffd0c30cc09 (diff)
move splitPackageNames to its own module
Diffstat (limited to 'test')
-rw-r--r--test/lib/utils/split-package-names.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/lib/utils/split-package-names.js b/test/lib/utils/split-package-names.js
new file mode 100644
index 000000000..c69bb2a3d
--- /dev/null
+++ b/test/lib/utils/split-package-names.js
@@ -0,0 +1,17 @@
+'use strict'
+
+const { test } = require('tap')
+const splitPackageNames = require('../../../lib/utils/split-package-names.js')
+
+test('splitPackageNames', t => {
+ const assertions = [
+ ['semver', 'semver'],
+ ['read-pkg/semver', 'read-pkg/node_modules/semver'],
+ ['@npmcli/one/@npmcli/two', '@npmcli/one/node_modules/@npmcli/two'],
+ ['@npmcli/one/semver', '@npmcli/one/node_modules/semver'],
+ ]
+
+ for (const [input, expected] of assertions)
+ t.equal(splitPackageNames(input), expected, `split ${input} correctly`)
+ t.end()
+})