@@ -9,6 +9,7 @@ var testFixtures = function (t, params, fixtures) {
99 var fixture = fixtures [ i ]
1010 var host = fixture . host ( params )
1111 var hostinfo = HostedGit . fromUrl ( host )
12+ var expectedHash = params . project
1213
1314 // INFO: from Url should return `undefined` from fixture input
1415 if ( fixture . isUndefined ) {
@@ -27,18 +28,18 @@ var testFixtures = function (t, params, fixtures) {
2728 }
2829 tt . is (
2930 hostinfo . https ( ) ,
30- expected ( ' git+https://gist.github.com/a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2 .git' , fixture . hasBranch ) ,
31+ expected ( ` git+https://gist.github.com/${ expectedHash } .git` , fixture . hasBranch ) ,
3132 showLabel ( fixture . label , 'https' )
3233 )
3334 tt . is (
3435 hostinfo . https ( { noCommittish : true } ) ,
3536 // INFO: not using `expected` because with `{noCommittish: true}` the output is always the same
36- ' git+https://gist.github.com/a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2 .git' ,
37+ ` git+https://gist.github.com/${ expectedHash } .git` ,
3738 showLabel ( fixture . label , 'https({ noCommittish: true })' )
3839 )
3940 tt . is (
4041 hostinfo . https ( { noGitPlus : true } ) ,
41- expected ( ' https://gist.github.com/a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2 .git' , fixture . hasBranch ) ,
42+ expected ( ` https://gist.github.com/${ expectedHash } .git` , fixture . hasBranch ) ,
4243 showLabel ( fixture . label , 'https({ noGitPlus: true })' )
4344 )
4445 tt . end ( )
@@ -51,18 +52,18 @@ var testFixtures = function (t, params, fixtures) {
5152 }
5253 tt . is (
5354 hostinfo . git ( ) ,
54- expected ( ' git://gist.github.com/a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2 .git' , fixture . hasBranch ) ,
55+ expected ( ` git://gist.github.com/${ expectedHash } .git` , fixture . hasBranch ) ,
5556 showLabel ( fixture . label , 'git' )
5657 )
5758 tt . is (
5859 hostinfo . git ( { noCommittish : true } ) ,
5960 // INFO: not using `expected` because with `{noCommittish: true}` the output is always the same
60- ' git://gist.github.com/a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2 .git' ,
61+ ` git://gist.github.com/${ expectedHash } .git` ,
6162 showLabel ( fixture . label , 'git({ noCommittish: true })' )
6263 )
6364 tt . is (
6465 hostinfo . git ( { noGitPlus : true } ) ,
65- expected ( ' git://gist.github.com/a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2 .git' , fixture . hasBranch ) ,
66+ expected ( ` git://gist.github.com/${ expectedHash } .git` , fixture . hasBranch ) ,
6667 showLabel ( fixture . label , 'git({ noGitPlus: true })' )
6768 )
6869 tt . end ( )
@@ -75,35 +76,35 @@ var testFixtures = function (t, params, fixtures) {
7576 }
7677 tt . is (
7778 hostinfo . browse ( ) ,
78- expected ( ' https://gist.github.com/a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2' , fixture . hasBranch ) ,
79+ expected ( ` https://gist.github.com/${ expectedHash } ` , fixture . hasBranch ) ,
7980 showLabel ( fixture . label , 'browse' )
8081 )
8182 tt . is (
8283 hostinfo . browse ( 'C' ) ,
83- expected ( ' https://gist.github.com/a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2' , fixture . hasBranch ) + '#file-c' ,
84+ expected ( ` https://gist.github.com/${ expectedHash } ` , fixture . hasBranch ) + '#file-c' ,
8485 showLabel ( fixture . label , "browse('C')" )
8586 )
8687 tt . is (
8788 hostinfo . browse ( 'C/D' ) ,
88- expected ( ' https://gist.github.com/a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2' , fixture . hasBranch ) + '#file-cd' ,
89+ expected ( ` https://gist.github.com/${ expectedHash } ` , fixture . hasBranch ) + '#file-cd' ,
8990 showLabel ( fixture . label , "browse('C/D')" )
9091 )
9192 tt . is (
9293 hostinfo . browse ( 'C' , 'A' ) ,
93- expected ( ' https://gist.github.com/a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2' , fixture . hasBranch ) + '#file-c' ,
94+ expected ( ` https://gist.github.com/${ expectedHash } ` , fixture . hasBranch ) + '#file-c' ,
9495 showLabel ( fixture . label , "browse('C', 'A')" )
9596 )
9697 tt . is (
9798 hostinfo . browse ( 'C/D' , 'A' ) ,
98- expected ( ' https://gist.github.com/a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2' , fixture . hasBranch ) + '#file-cd' ,
99+ expected ( ` https://gist.github.com/${ expectedHash } ` , fixture . hasBranch ) + '#file-cd' ,
99100 showLabel ( fixture . label , "browse('C/D', 'A')" )
100101 )
101102 tt . end ( )
102103 } )
103104 t . test ( 'hostinfo.bugs' , function ( tt ) {
104105 tt . is (
105106 hostinfo . bugs ( ) ,
106- ' https://gist.github.com/a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2' ,
107+ ` https://gist.github.com/${ expectedHash } ` ,
107108 showLabel ( fixture . label , 'bugs' )
108109 )
109110 tt . end ( )
@@ -116,7 +117,7 @@ var testFixtures = function (t, params, fixtures) {
116117 }
117118 tt . is (
118119 hostinfo . docs ( ) ,
119- expected ( ' https://gist.github.com/a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2' , fixture . hasBranch ) ,
120+ expected ( ` https://gist.github.com/${ expectedHash } ` , fixture . hasBranch ) ,
120121 showLabel ( fixture . label , 'docs' )
121122 )
122123 tt . end ( )
@@ -129,7 +130,7 @@ var testFixtures = function (t, params, fixtures) {
129130 }
130131 tt . is (
131132 hostinfo . ssh ( ) ,
132- expected ( ' [email protected] :/a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2 .git' , fixture . hasBranch ) , 133+ expected ( ` [email protected] :/${ expectedHash } .git` , fixture . hasBranch ) , 133134 showLabel ( fixture . label , 'ssh' )
134135 )
135136 tt . end ( )
@@ -142,7 +143,7 @@ var testFixtures = function (t, params, fixtures) {
142143 }
143144 tt . is (
144145 hostinfo . sshurl ( ) ,
145- expected ( ' git+ssh://[email protected] /a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2 .git' , fixture . hasBranch ) , 146+ expected ( ` git+ssh://[email protected] /${ expectedHash } .git` , fixture . hasBranch ) , 146147 showLabel ( fixture . label , 'sshurl' )
147148 )
148149 tt . end ( )
@@ -155,7 +156,7 @@ var testFixtures = function (t, params, fixtures) {
155156 }
156157 tt . is (
157158 hostinfo . shortcut ( ) ,
158- expected ( ' gist:a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2' , fixture . hasBranch ) ,
159+ expected ( ` gist:${ expectedHash } ` , fixture . hasBranch ) ,
159160 showLabel ( fixture . label , 'shortcut' )
160161 )
161162 tt . end ( )
@@ -169,27 +170,27 @@ var testFixtures = function (t, params, fixtures) {
169170 }
170171 tt . is (
171172 hostinfo . file ( ) ,
172- expected ( ' https://gist.githubusercontent.com/some-owner/a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2 /raw/' , fixture . hasBranch ) ,
173+ expected ( ` https://gist.githubusercontent.com/some-owner/${ expectedHash } /raw/` , fixture . hasBranch ) ,
173174 showLabel ( fixture . label , 'file' )
174175 )
175176 tt . is (
176177 hostinfo . file ( '' ) ,
177- expected ( ' https://gist.githubusercontent.com/some-owner/a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2 /raw/' , fixture . hasBranch ) ,
178+ expected ( ` https://gist.githubusercontent.com/some-owner/${ expectedHash } /raw/` , fixture . hasBranch ) ,
178179 showLabel ( fixture . label , "file('')" )
179180 )
180181 tt . is (
181182 hostinfo . file ( 'C' ) ,
182- expected ( ' https://gist.githubusercontent.com/some-owner/a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2 /raw/' , fixture . hasBranch ) + 'C' ,
183+ expected ( ` https://gist.githubusercontent.com/some-owner/${ expectedHash } /raw/` , fixture . hasBranch ) + 'C' ,
183184 showLabel ( fixture . label , "file('C')" )
184185 )
185186 tt . is (
186187 hostinfo . file ( 'C/D' ) ,
187- expected ( ' https://gist.githubusercontent.com/some-owner/a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2 /raw/' , fixture . hasBranch ) + 'C/D' ,
188+ expected ( ` https://gist.githubusercontent.com/some-owner/${ expectedHash } /raw/` , fixture . hasBranch ) + 'C/D' ,
188189 showLabel ( fixture . label , "file('C/D')" )
189190 )
190191 tt . is (
191192 hostinfo . file ( 'C' , 'A' ) ,
192- expected ( ' https://gist.githubusercontent.com/some-owner/a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2 /raw/' , fixture . hasBranch ) + 'C' ,
193+ expected ( ` https://gist.githubusercontent.com/some-owner/${ expectedHash } /raw/` , fixture . hasBranch ) + 'C' ,
193194 showLabel ( fixture . label , "file('C', 'A')" )
194195 )
195196 tt . end ( )
@@ -202,12 +203,12 @@ var testFixtures = function (t, params, fixtures) {
202203 }
203204 tt . is (
204205 hostinfo . tarball ( ) ,
205- expected ( ' https://codeload.github.com/gist/a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2 /tar.gz/master' , fixture . hasBranch ) ,
206+ expected ( ` https://codeload.github.com/gist/${ expectedHash } /tar.gz/master` , fixture . hasBranch ) ,
206207 showLabel ( fixture . label , 'tarball' )
207208 )
208209 tt . is (
209210 hostinfo . tarball ( { noCommittish : true } ) ,
210- expected ( ' https://codeload.github.com/gist/a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2 /tar.gz/master' , fixture . hasBranch ) ,
211+ expected ( ` https://codeload.github.com/gist/${ expectedHash } /tar.gz/master` , fixture . hasBranch ) ,
211212 showLabel ( fixture . label , 'tarball({ noCommittish: true })' )
212213 )
213214 tt . end ( )
@@ -222,7 +223,7 @@ var testFixtures = function (t, params, fixtures) {
222223 }
223224 tt . is (
224225 hostinfo . toString ( ) ,
225- expected ( ' git+https://gist.github.com/a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2 .git' , fixture . hasBranch ) ,
226+ expected ( ` git+https://gist.github.com/${ expectedHash } .git` , fixture . hasBranch ) ,
226227 showLabel ( fixture . label , 'toString' )
227228 )
228229 tt . end ( )
@@ -249,5 +250,19 @@ test('fromUrl(gist url)', function (t) {
249250 tt . end ( )
250251 } )
251252
253+ t . test ( 'legacy gist hash length' , function ( tt ) {
254+ var params = {
255+ domain : 'gist.github.com' ,
256+ shortname : 'github' ,
257+ label : 'github' ,
258+ owner : 'some-owner' ,
259+ project : '3135914' ,
260+ branch : 'feature-branch'
261+ }
262+
263+ testFixtures ( tt , params , collectedFixtures )
264+ tt . end ( )
265+ } )
266+
252267 t . end ( )
253268} )
0 commit comments