node/deps/npm/node_modules/github-url-from-username-repo/test/index.js

35 lines
1.0 KiB
JavaScript
Raw Normal View History

2013-10-25 00:21:59 +08:00
var assert = require("assert")
var getUrl = require("../")
describe("github url from username/repo", function () {
it("returns a github url for the username/repo", function () {
var url = getUrl("visionmedia/express")
2014-08-01 00:05:30 +08:00
assert.equal("https://github.com/visionmedia/express", url)
2013-10-25 00:21:59 +08:00
})
2013-10-25 00:21:59 +08:00
it("returns null if it does not match", function () {
var url = getUrl("package")
assert.deepEqual(null, url)
})
it("returns null if no repo/user was given", function () {
2013-10-25 00:21:59 +08:00
var url = getUrl()
assert.deepEqual(null, url)
})
it("works with .", function () {
var url = getUrl("component/downloader.js")
2014-08-01 00:05:30 +08:00
assert.equal("https://github.com/component/downloader.js", url)
})
it("works with . in the beginning", function () {
var url = getUrl("component/.downloader.js")
2014-08-01 00:05:30 +08:00
assert.equal("https://github.com/component/.downloader.js", url)
})
it("works with -", function () {
var url = getUrl("component/-dow-nloader.j-s")
2014-08-01 00:05:30 +08:00
assert.equal("https://github.com/component/-dow-nloader.j-s", url)
2013-10-25 00:21:59 +08:00
})
})