@@ -9,6 +9,7 @@ var testFixtures = function (t, params, fixtures) {
9
9
var fixture = fixtures [ i ]
10
10
var host = fixture . host ( params )
11
11
var hostinfo = HostedGit . fromUrl ( host )
12
+ var expectedHash = params . project
12
13
13
14
// INFO: from Url should return `undefined` from fixture input
14
15
if ( fixture . isUndefined ) {
@@ -27,18 +28,18 @@ var testFixtures = function (t, params, fixtures) {
27
28
}
28
29
tt . is (
29
30
hostinfo . https ( ) ,
30
- expected ( ' git+https://gist.github.com/a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2 .git' , fixture . hasBranch ) ,
31
+ expected ( ` git+https://gist.github.com/${ expectedHash } .git` , fixture . hasBranch ) ,
31
32
showLabel ( fixture . label , 'https' )
32
33
)
33
34
tt . is (
34
35
hostinfo . https ( { noCommittish : true } ) ,
35
36
// 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` ,
37
38
showLabel ( fixture . label , 'https({ noCommittish: true })' )
38
39
)
39
40
tt . is (
40
41
hostinfo . https ( { noGitPlus : true } ) ,
41
- expected ( ' https://gist.github.com/a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2 .git' , fixture . hasBranch ) ,
42
+ expected ( ` https://gist.github.com/${ expectedHash } .git` , fixture . hasBranch ) ,
42
43
showLabel ( fixture . label , 'https({ noGitPlus: true })' )
43
44
)
44
45
tt . end ( )
@@ -51,18 +52,18 @@ var testFixtures = function (t, params, fixtures) {
51
52
}
52
53
tt . is (
53
54
hostinfo . git ( ) ,
54
- expected ( ' git://gist.github.com/a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2 .git' , fixture . hasBranch ) ,
55
+ expected ( ` git://gist.github.com/${ expectedHash } .git` , fixture . hasBranch ) ,
55
56
showLabel ( fixture . label , 'git' )
56
57
)
57
58
tt . is (
58
59
hostinfo . git ( { noCommittish : true } ) ,
59
60
// 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` ,
61
62
showLabel ( fixture . label , 'git({ noCommittish: true })' )
62
63
)
63
64
tt . is (
64
65
hostinfo . git ( { noGitPlus : true } ) ,
65
- expected ( ' git://gist.github.com/a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2 .git' , fixture . hasBranch ) ,
66
+ expected ( ` git://gist.github.com/${ expectedHash } .git` , fixture . hasBranch ) ,
66
67
showLabel ( fixture . label , 'git({ noGitPlus: true })' )
67
68
)
68
69
tt . end ( )
@@ -75,35 +76,35 @@ var testFixtures = function (t, params, fixtures) {
75
76
}
76
77
tt . is (
77
78
hostinfo . browse ( ) ,
78
- expected ( ' https://gist.github.com/a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2' , fixture . hasBranch ) ,
79
+ expected ( ` https://gist.github.com/${ expectedHash } ` , fixture . hasBranch ) ,
79
80
showLabel ( fixture . label , 'browse' )
80
81
)
81
82
tt . is (
82
83
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' ,
84
85
showLabel ( fixture . label , "browse('C')" )
85
86
)
86
87
tt . is (
87
88
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' ,
89
90
showLabel ( fixture . label , "browse('C/D')" )
90
91
)
91
92
tt . is (
92
93
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' ,
94
95
showLabel ( fixture . label , "browse('C', 'A')" )
95
96
)
96
97
tt . is (
97
98
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' ,
99
100
showLabel ( fixture . label , "browse('C/D', 'A')" )
100
101
)
101
102
tt . end ( )
102
103
} )
103
104
t . test ( 'hostinfo.bugs' , function ( tt ) {
104
105
tt . is (
105
106
hostinfo . bugs ( ) ,
106
- ' https://gist.github.com/a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2' ,
107
+ ` https://gist.github.com/${ expectedHash } ` ,
107
108
showLabel ( fixture . label , 'bugs' )
108
109
)
109
110
tt . end ( )
@@ -116,7 +117,7 @@ var testFixtures = function (t, params, fixtures) {
116
117
}
117
118
tt . is (
118
119
hostinfo . docs ( ) ,
119
- expected ( ' https://gist.github.com/a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2' , fixture . hasBranch ) ,
120
+ expected ( ` https://gist.github.com/${ expectedHash } ` , fixture . hasBranch ) ,
120
121
showLabel ( fixture . label , 'docs' )
121
122
)
122
123
tt . end ( )
@@ -129,7 +130,7 @@ var testFixtures = function (t, params, fixtures) {
129
130
}
130
131
tt . is (
131
132
hostinfo . ssh ( ) ,
132
- expected ( ' git@gist.github.com:/a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2 .git' , fixture . hasBranch ) ,
133
+ expected ( ` git@gist.github.com:/${ expectedHash } .git` , fixture . hasBranch ) ,
133
134
showLabel ( fixture . label , 'ssh' )
134
135
)
135
136
tt . end ( )
@@ -142,7 +143,7 @@ var testFixtures = function (t, params, fixtures) {
142
143
}
143
144
tt . is (
144
145
hostinfo . sshurl ( ) ,
145
- expected ( ' git+ssh://git@gist.github.com/a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2 .git' , fixture . hasBranch ) ,
146
+ expected ( ` git+ssh://git@gist.github.com/${ expectedHash } .git` , fixture . hasBranch ) ,
146
147
showLabel ( fixture . label , 'sshurl' )
147
148
)
148
149
tt . end ( )
@@ -155,7 +156,7 @@ var testFixtures = function (t, params, fixtures) {
155
156
}
156
157
tt . is (
157
158
hostinfo . shortcut ( ) ,
158
- expected ( ' gist:a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2' , fixture . hasBranch ) ,
159
+ expected ( ` gist:${ expectedHash } ` , fixture . hasBranch ) ,
159
160
showLabel ( fixture . label , 'shortcut' )
160
161
)
161
162
tt . end ( )
@@ -169,27 +170,27 @@ var testFixtures = function (t, params, fixtures) {
169
170
}
170
171
tt . is (
171
172
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 ) ,
173
174
showLabel ( fixture . label , 'file' )
174
175
)
175
176
tt . is (
176
177
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 ) ,
178
179
showLabel ( fixture . label , "file('')" )
179
180
)
180
181
tt . is (
181
182
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' ,
183
184
showLabel ( fixture . label , "file('C')" )
184
185
)
185
186
tt . is (
186
187
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' ,
188
189
showLabel ( fixture . label , "file('C/D')" )
189
190
)
190
191
tt . is (
191
192
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' ,
193
194
showLabel ( fixture . label , "file('C', 'A')" )
194
195
)
195
196
tt . end ( )
@@ -202,12 +203,12 @@ var testFixtures = function (t, params, fixtures) {
202
203
}
203
204
tt . is (
204
205
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 ) ,
206
207
showLabel ( fixture . label , 'tarball' )
207
208
)
208
209
tt . is (
209
210
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 ) ,
211
212
showLabel ( fixture . label , 'tarball({ noCommittish: true })' )
212
213
)
213
214
tt . end ( )
@@ -222,7 +223,7 @@ var testFixtures = function (t, params, fixtures) {
222
223
}
223
224
tt . is (
224
225
hostinfo . toString ( ) ,
225
- expected ( ' git+https://gist.github.com/a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2 .git' , fixture . hasBranch ) ,
226
+ expected ( ` git+https://gist.github.com/${ expectedHash } .git` , fixture . hasBranch ) ,
226
227
showLabel ( fixture . label , 'toString' )
227
228
)
228
229
tt . end ( )
@@ -249,5 +250,19 @@ test('fromUrl(gist url)', function (t) {
249
250
tt . end ( )
250
251
} )
251
252
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
+
252
267
t . end ( )
253
268
} )
0 commit comments