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
diff options
context:
space:
mode:
Diffstat (limited to 'test/lib/utils/hosted-git-info-from-manifest.js')
-rw-r--r--test/lib/utils/hosted-git-info-from-manifest.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/lib/utils/hosted-git-info-from-manifest.js b/test/lib/utils/hosted-git-info-from-manifest.js
new file mode 100644
index 000000000..f87cb84ee
--- /dev/null
+++ b/test/lib/utils/hosted-git-info-from-manifest.js
@@ -0,0 +1,21 @@
+const t = require('tap')
+const hostedFromMani = require('../../../lib/utils/hosted-git-info-from-manifest.js')
+const hostedGitInfo = require('hosted-git-info')
+
+t.equal(hostedFromMani({}), null)
+t.equal(hostedFromMani({ repository: { no: 'url' } }), null)
+t.equal(hostedFromMani({ repository: 123 }), null)
+t.equal(hostedFromMani({ repository: 'not hosted anywhere' }), null)
+t.equal(hostedFromMani({ repository: { url: 'not hosted anywhere' } }), null)
+
+t.match(hostedFromMani({
+ repository: 'git+https://github.com/isaacs/abbrev-js'
+}), hostedGitInfo.fromUrl('git+https://github.com/isaacs/abbrev-js'))
+
+t.match(hostedFromMani({
+ repository: { url: 'git+https://github.com/isaacs/abbrev-js' }
+}), hostedGitInfo.fromUrl('https://github.com/isaacs/abbrev-js'))
+
+t.match(hostedFromMani({
+ repository: { url: 'git+ssh://git@github.com/isaacs/abbrev-js' }
+}), hostedGitInfo.fromUrl('ssh://git@github.com/isaacs/abbrev-js'))