This repository has been archived by the owner on Jan 23, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(task): extract repo from github urls #164
- Loading branch information
m7r
committed
Aug 12, 2015
1 parent
eefbaa7
commit 886be9d
Showing
2 changed files
with
50 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
describe('prepareLinks', function() { | ||
var grunt = require('grunt'); | ||
var prepareLinks = require('../tasks/grunt-ngdocs.js')(grunt).prepareLinks; | ||
|
||
it('should handel github https url', function() { | ||
var pkg = {repository: {url: 'https://github.com/owner/name'}}; | ||
var opts = {sourceEdit:true, editLink: true}; | ||
prepareLinks(pkg, opts); | ||
expect(opts.editLink('test.js')).toEqual('https://github.com/owner/name/edit/master/test.js'); | ||
}); | ||
|
||
it('should handel github https url with .git suffix', function() { | ||
var pkg = {repository: {url: 'https://github.com/owner/name.git'}}; | ||
var opts = {sourceEdit:true, editLink: true}; | ||
prepareLinks(pkg, opts); | ||
expect(opts.editLink('test.js')).toEqual('https://github.com/owner/name/edit/master/test.js'); | ||
}); | ||
|
||
it('should handel github https url with .git and path suffix', function() { | ||
var pkg = {repository: {url: 'https://github.com/owner/name.git/#123456/'}}; | ||
var opts = {sourceEdit:true, editLink: true}; | ||
prepareLinks(pkg, opts); | ||
expect(opts.editLink('test.js')).toEqual('https://github.com/owner/name/edit/master/test.js'); | ||
}); | ||
|
||
it('should handel git@github url', function() { | ||
var pkg = {repository: {url: 'git@github.com:owner/name'}}; | ||
var opts = {sourceEdit:true, editLink: true}; | ||
prepareLinks(pkg, opts); | ||
expect(opts.editLink('test.js')).toEqual('https://github.com/owner/name/edit/master/test.js'); | ||
}); | ||
|
||
it('should handel git@github url with .git suffix', function() { | ||
var pkg = {repository: {url: 'git@github.com:owner/name.git'}}; | ||
var opts = {sourceEdit:true, editLink: true}; | ||
prepareLinks(pkg, opts); | ||
expect(opts.editLink('test.js')).toEqual('https://github.com/owner/name/edit/master/test.js'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters