-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathtest.js
75 lines (70 loc) · 2.5 KB
/
test.js
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*!
* is-git-url <https://github.com/jonschlinkert/is-git-url>
*
* Copyright (c) 2015, 2017, Jon Schlinkert.
* Released under the MIT License.
*/
require('mocha');
var assert = require('assert');
var isGitUrl = require('./');
var validURLs = [
'git://github.com/ember-cli/ember-cli.git#ff786f9f',
'git://github.com/ember-cli/ember-cli.git#gh-pages',
'git://github.com/ember-cli/ember-cli.git#master',
'git://github.com/ember-cli/ember-cli.git#Quick-Fix',
'git://github.com/ember-cli/ember-cli.git#quick_fix',
'git://github.com/ember-cli/ember-cli.git#v0.1.0',
'git://host.xz/path/to/repo.git/',
'git://host.xz/~user/path/to/repo.git/',
'[email protected]:user/project.git',
'[email protected]:user/project.git',
'[email protected]:user/some-project.git',
'[email protected]:user/some-project.git',
'[email protected]:user/some_project.git',
'[email protected]:user/some_project.git',
'http://192.168.101.127/user/project.git',
'http://github.com/user/project.git',
'http://host.xz/path/to/repo.git/',
'https://192.168.101.127/user/project.git',
'https://github.com/user/project.git',
'https://host.xz/path/to/repo.git/',
'https://username::;*%$:@github.com/username/repository.git',
'https://username:$fooABC@:@github.com/username/repository.git',
'https://username:[email protected]/username/repository.git',
'ssh://host.xz/path/to/repo.git/',
'ssh://host.xz/path/to/repo.git/',
'ssh://host.xz/~/path/to/repo.git',
'ssh://host.xz/~user/path/to/repo.git/',
'ssh://host.xz:port/path/to/repo.git/',
'ssh://[email protected]/path/to/repo.git/',
'ssh://[email protected]/path/to/repo.git/',
'ssh://[email protected]/~/path/to/repo.git',
'ssh://[email protected]/~user/path/to/repo.git/',
'ssh://[email protected]:port/path/to/repo.git/',
];
var invalidURLs = [
'/path/to/repo.git/',
'file:///path/to/repo.git/',
'file://~/path/to/repo.git/',
'[email protected]:user/some_project.git/foo',
'[email protected]:user/some_project.gitfoo',
'host.xz:/path/to/repo.git/',
'host.xz:path/to/repo.git',
'host.xz:~user/path/to/repo.git/',
'path/to/repo.git/',
'rsync://host.xz/path/to/repo.git/',
'[email protected]:/path/to/repo.git/',
'[email protected]:path/to/repo.git',
'[email protected]:~user/path/to/repo.git/',
'~/path/to/repo.git'
];
validURLs.forEach(function(url, i) {
it('git URL: #' + (i++) + ' - ' + url, function () {
assert(isGitUrl(url) === true);
});
});
invalidURLs.forEach(function(url, i) {
it('not a git url #' + (i++) + ' - ' + url, function () {
assert(isGitUrl(url) === false);
});
});