Welcome to mirror list, hosted at ThFree Co, Russian Federation.

basic.js « test « normalize-git-url « node_modules - github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 00ac6d3131b445275edee87931716eb4ef8c438a (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
var test = require('tap').test

var normalize = require('../normalize-git-url.js')

test('basic normalization tests', function (t) {
  t.same(
    normalize('git+ssh://user@hostname:project.git#commit-ish'),
    { url: 'user@hostname:project.git', branch: 'commit-ish' }
  )
  t.same(
    normalize('git+http://user@hostname/project/blah.git#commit-ish'),
    { url: 'http://user@hostname/project/blah.git', branch: 'commit-ish' }
  )
  t.same(
    normalize('git+https://user@hostname/project/blah.git#commit-ish'),
    { url: 'https://user@hostname/project/blah.git', branch: 'commit-ish' }
  )
  t.same(
    normalize('git+ssh://git@github.com:npm/npm.git#v1.0.27'),
    { url: 'git@github.com:npm/npm.git', branch: 'v1.0.27' }
  )
  t.same(
    normalize('git+ssh://git@github.com:org/repo#dev'),
    { url: 'git@github.com:org/repo', branch: 'dev' }
  )
  t.same(
    normalize('git+ssh://git@github.com/org/repo#dev'),
    { url: 'ssh://git@github.com/org/repo', branch: 'dev' }
  )
  t.same(
    normalize('git+ssh://foo:22/some/path'),
    { url: 'ssh://foo:22/some/path', branch: 'master' }
  )
  t.same(
    normalize('git@github.com:org/repo#dev'),
    { url: 'git@github.com:org/repo', branch: 'dev' }
  )
  t.same(
    normalize('git+https://github.com/KenanY/node-uuid'),
    { url: 'https://github.com/KenanY/node-uuid', branch: 'master' }
  )
  t.same(
    normalize('git+https://github.com/KenanY/node-uuid#7a018f2d075b03a73409e8356f9b29c9ad4ea2c5'),
    { url: 'https://github.com/KenanY/node-uuid', branch: '7a018f2d075b03a73409e8356f9b29c9ad4ea2c5' }
  )
  t.same(
    normalize('git+ssh://git@git.example.com:b/b.git#v1.0.0'),
    { url: 'git@git.example.com:b/b.git', branch: 'v1.0.0' }
  )
  t.same(
    normalize('git+ssh://git@github.com:npm/npm-proto.git#othiym23/organized'),
    { url: 'git@github.com:npm/npm-proto.git', branch: 'othiym23/organized' }
  )

  t.end()
})