summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/github-url-from-username-repo/test/index.js
blob: 14c7dd16c28696d2839a514fe163573ef1e68f72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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")
    assert.equal("https://github.com/visionmedia/express", url)
  })

  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 () {
    var url = getUrl()
    assert.deepEqual(null, url)
  })

  it("works with .", function () {
    var url = getUrl("component/downloader.js")
    assert.equal("https://github.com/component/downloader.js", url)
  })

  it("works with . in the beginning", function () {
    var url = getUrl("component/.downloader.js")
    assert.equal("https://github.com/component/.downloader.js", url)
  })

  it("works with -", function () {
    var url = getUrl("component/-dow-nloader.j-s")
    assert.equal("https://github.com/component/-dow-nloader.j-s", url)
  })
})