Skip to content

Commit 953b37f

Browse files
committed
Move tests for git.isGitUrl() to location.isGitUrl()
1 parent bc263c9 commit 953b37f

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

lib/utils/__tests__/git.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,6 @@ describe('Git', function() {
77

88
describe('URL parsing', function() {
99

10-
it('should correctly validate git urls', function() {
11-
// HTTPS
12-
expect(Git.isUrl('git+https://github.com/Hello/world.git')).toBeTruthy();
13-
14-
// SSH
15-
expect(Git.isUrl('[email protected]:GitbookIO/gitbook.git/directory/README.md#e1594cde2c32e4ff48f6c4eff3d3d461743d74e1')).toBeTruthy();
16-
17-
// Non valid
18-
expect(Git.isUrl('https://github.com/Hello/world.git')).not.toBeTruthy();
19-
expect(Git.isUrl('README.md')).not.toBeTruthy();
20-
});
21-
2210
it('should parse HTTPS urls', function() {
2311
var parts = Git.parseUrl('git+https://gist.github.com/69ea4542e4c8967d2fa7.git/test.md');
2412

lib/utils/__tests__/location.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@ describe('LocationUtils', function() {
2020
expect(LocationUtils.isDataURI('data.md')).toBe(false);
2121
});
2222

23+
it('should correctly validate git urls', function() {
24+
// HTTPS
25+
expect(LocationUtils.isGitUrl('git+https://github.com/Hello/world.git')).toBeTruthy();
26+
27+
// SSH
28+
expect(LocationUtils.isGitUrl('[email protected]:GitbookIO/gitbook.git/directory/README.md#e1594cde2c32e4ff48f6c4eff3d3d461743d74e1')).toBeTruthy();
29+
30+
// Non valid
31+
expect(LocationUtils.isGitUrl('https://github.com/Hello/world.git')).not.toBeTruthy();
32+
expect(LocationUtils.isGitUrl('README.md')).not.toBeTruthy();
33+
});
34+
2335
it('should correctly detect anchor location', function() {
2436
expect(LocationUtils.isAnchor('#test')).toBe(true);
2537
expect(LocationUtils.isAnchor(' #test')).toBe(true);

0 commit comments

Comments
 (0)