diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-12-22 10:18:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-22 10:18:38 +0100 |
commit | 194ebc3da9641ff96f083f9d8ab43c2d27944f9a (patch) | |
tree | c50988f32ccf18df93ae7ab40be78e9459642818 /lib/utils/__tests__/git.js | |
parent | 64ccb6b00b4b63fa0e516d4e35351275b34f8c07 (diff) | |
parent | 16af264360e48e8a833e9efa9ab8d194574dbc70 (diff) | |
download | gitbook-194ebc3da9641ff96f083f9d8ab43c2d27944f9a.zip gitbook-194ebc3da9641ff96f083f9d8ab43c2d27944f9a.tar.gz gitbook-194ebc3da9641ff96f083f9d8ab43c2d27944f9a.tar.bz2 |
Merge pull request #1543 from GitbookIO/dream
React for rendering website with plugins
Diffstat (limited to 'lib/utils/__tests__/git.js')
-rw-r--r-- | lib/utils/__tests__/git.js | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/lib/utils/__tests__/git.js b/lib/utils/__tests__/git.js deleted file mode 100644 index abc1ea1..0000000 --- a/lib/utils/__tests__/git.js +++ /dev/null @@ -1,57 +0,0 @@ -var path = require('path'); -var os = require('os'); - -var Git = require('../git'); - -describe('Git', function() { - - describe('URL parsing', function() { - - it('should correctly validate git urls', function() { - // HTTPS - expect(Git.isUrl('git+https://github.com/Hello/world.git')).toBeTruthy(); - - // SSH - expect(Git.isUrl('git+git@github.com:GitbookIO/gitbook.git/directory/README.md#e1594cde2c32e4ff48f6c4eff3d3d461743d74e1')).toBeTruthy(); - - // Non valid - expect(Git.isUrl('https://github.com/Hello/world.git')).toBeFalsy(); - expect(Git.isUrl('README.md')).toBeFalsy(); - }); - - it('should parse HTTPS urls', function() { - var parts = Git.parseUrl('git+https://gist.github.com/69ea4542e4c8967d2fa7.git/test.md'); - - expect(parts.host).toBe('https://gist.github.com/69ea4542e4c8967d2fa7.git'); - expect(parts.ref).toBe(null); - expect(parts.filepath).toBe('test.md'); - }); - - it('should parse HTTPS urls with a reference', function() { - var parts = Git.parseUrl('git+https://gist.github.com/69ea4542e4c8967d2fa7.git/test.md#1.0.0'); - - expect(parts.host).toBe('https://gist.github.com/69ea4542e4c8967d2fa7.git'); - expect(parts.ref).toBe('1.0.0'); - expect(parts.filepath).toBe('test.md'); - }); - - it('should parse SSH urls', function() { - var parts = Git.parseUrl('git+git@github.com:GitbookIO/gitbook.git/directory/README.md#e1594cde2c32e4ff48f6c4eff3d3d461743d74e1'); - - expect(parts.host).toBe('git@github.com:GitbookIO/gitbook.git'); - expect(parts.ref).toBe('e1594cde2c32e4ff48f6c4eff3d3d461743d74e1'); - expect(parts.filepath).toBe('directory/README.md'); - }); - }); - - describe('Cloning and resolving', function() { - it('should clone an HTTPS url', function() { - var git = new Git(path.join(os.tmpdir(), 'test-git-'+Date.now())); - return git.resolve('git+https://gist.github.com/69ea4542e4c8967d2fa7.git/test.md') - .then(function(filename) { - expect(path.extname(filename)).toBe('.md'); - }); - }); - }); - -}); |