1 var test = require('tap').test
3 var normalize = require('../normalize-git-url.js')
5 test('basic normalization tests', function (t) {
7 normalize('git+ssh://user@hostname:project.git#commit-ish'),
8 { url: 'user@hostname:project.git', branch: 'commit-ish' }
11 normalize('git+http://user@hostname/project/blah.git#commit-ish'),
12 { url: 'http://user@hostname/project/blah.git', branch: 'commit-ish' }
15 normalize('git+https://user@hostname/project/blah.git#commit-ish'),
16 { url: 'https://user@hostname/project/blah.git', branch: 'commit-ish' }
19 normalize('git+https://user@hostname:project/blah.git#commit-ish'),
20 { url: 'https://user@hostname/project/blah.git', branch: 'commit-ish' }
23 normalize('git+ssh://git@github.com:npm/npm.git#v1.0.27'),
24 { url: 'git@github.com:npm/npm.git', branch: 'v1.0.27' }
27 normalize('git+ssh://git@github.com:/npm/npm.git#v1.0.28'),
28 { url: 'git@github.com:/npm/npm.git', branch: 'v1.0.28' }
31 normalize('git+ssh://git@github.com:org/repo#dev'),
32 { url: 'git@github.com:org/repo', branch: 'dev' }
35 normalize('git+ssh://git@github.com/org/repo#dev'),
36 { url: 'ssh://git@github.com/org/repo', branch: 'dev' }
39 normalize('git+ssh://foo:22/some/path'),
40 { url: 'ssh://foo:22/some/path', branch: 'master' }
43 normalize('git@github.com:org/repo#dev'),
44 { url: 'git@github.com:org/repo', branch: 'dev' }
47 normalize('git+https://github.com/KenanY/node-uuid'),
48 { url: 'https://github.com/KenanY/node-uuid', branch: 'master' }
51 normalize('git+https://github.com/KenanY/node-uuid#7a018f2d075b03a73409e8356f9b29c9ad4ea2c5'),
52 { url: 'https://github.com/KenanY/node-uuid', branch: '7a018f2d075b03a73409e8356f9b29c9ad4ea2c5' }
55 normalize('git+ssh://git@git.example.com:b/b.git#v1.0.0'),
56 { url: 'git@git.example.com:b/b.git', branch: 'v1.0.0' }
59 normalize('git+ssh://git@github.com:npm/npm-proto.git#othiym23/organized'),
60 { url: 'git@github.com:npm/npm-proto.git', branch: 'othiym23/organized' }
63 normalize('git+file:///foo/bar.git'),
64 { url: 'file:///foo/bar.git', branch: 'master' }
67 normalize('git+file://C:\\Users\\hello\\testing.git#zkat/windows-files'),
68 { url: 'file://C:\\Users\\hello\\testing.git', branch: 'zkat/windows-files'}