diff options
Diffstat (limited to 'deps/npm/node_modules/hosted-git-info/test/bitbucket.js')
-rw-r--r-- | deps/npm/node_modules/hosted-git-info/test/bitbucket.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/deps/npm/node_modules/hosted-git-info/test/bitbucket.js b/deps/npm/node_modules/hosted-git-info/test/bitbucket.js new file mode 100644 index 00000000000..87127231458 --- /dev/null +++ b/deps/npm/node_modules/hosted-git-info/test/bitbucket.js @@ -0,0 +1,23 @@ +"use strict" +var HostedGit = require("../index") +var test = require("tap").test + +test("fromUrl(bitbucket url)", function (t) { + function verify(host, label, branch) { + var hostinfo = HostedGit.fromUrl(host) + var hash = branch ? "#" + branch : "" + t.ok(hostinfo, label) + if (! hostinfo) return + t.is( hostinfo.https(), "https://bitbucket.org/111/222.git" + hash, label + " -> https" ) + t.is( hostinfo.browse(), "https://bitbucket.org/111/222" + (branch ? "/src/" + branch : ""), label + " -> browse" ) + t.is( hostinfo.docs(), "https://bitbucket.org/111/222" + (branch ? "/src/" + branch : "") + "#readme", label + " -> docs" ) + t.is( hostinfo.ssh(), "git@bitbucket.org:111/222.git" + hash, label + " -> ssh" ) + t.is( hostinfo.sshurl(), "git+ssh://git@bitbucket.org/111/222.git" + hash, label + " -> sshurl" ) + t.is( (""+hostinfo), "git+ssh://git@bitbucket.org/111/222.git" + hash, label + " -> stringify" ) + t.is( hostinfo.file("C"), "https://bitbucket.org/111/222/raw/"+(branch||"master")+"/C", label + " -> file" ) + } + + require('./lib/standard-tests')(verify, "bitbucket.org", "bitbucket") + + t.end() +}) |