@@ -9,26 +9,26 @@ const skip = 'skip'; // To be used only to skip tests of combined functions, i.e
9
9
const domBased = 'skip' ; // To be used only to skip tests that are DOM-based rather than URL-based
10
10
11
11
export const is404 = ( ) : boolean => document . title === 'Page not found · GitHub' ;
12
- export const is404Test = domBased ; // They're specified in page-detect.ts
12
+ export const _is404 = domBased ; // They're specified in page-detect.ts
13
13
14
14
export const is500 = ( ) : boolean => document . title === 'Server Error · GitHub' || document . title === 'Unicorn! · GitHub' ;
15
- export const is500Test = domBased ; // They're specified in page-detect.ts
15
+ export const _is500 = domBased ; // They're specified in page-detect.ts
16
16
17
17
export const isBlame = ( ) : boolean => / ^ b l a m e \/ / . test ( getRepoPath ( ) ! ) ;
18
- export const isBlameTest = [
18
+ export const _isBlame = [
19
19
'https://github.com/sindresorhus/refined-github/blame/master/package.json'
20
20
] ;
21
21
22
22
export const isCommit = ( ) : boolean => isSingleCommit ( ) || isPRCommit ( ) ;
23
- export const isCommitTest = [
23
+ export const _isCommit = [
24
24
'https://github.com/sindresorhus/refined-github/commit/5b614b9035f2035b839f48b4db7bd5c3298d526f' ,
25
25
'https://github.com/sindresorhus/refined-github/commit/5b614' ,
26
26
'https://github.com/sindresorhus/refined-github/pull/148/commits/0019603b83bd97c2f7ef240969f49e6126c5ec85' ,
27
27
'https://github.com/sindresorhus/refined-github/pull/148/commits/00196'
28
28
] ;
29
29
30
30
export const isCommitList = ( ) : boolean => / ^ c o m m i t s \/ / . test ( getRepoPath ( ) ! ) ;
31
- export const isCommitListTest = [
31
+ export const _isCommitList = [
32
32
'https://github.com/sindresorhus/refined-github/commits/master?page=2' ,
33
33
'https://github.com/sindresorhus/refined-github/commits/test-branch' ,
34
34
'https://github.com/sindresorhus/refined-github/commits/0.13.0' ,
@@ -37,7 +37,7 @@ export const isCommitListTest = [
37
37
] ;
38
38
39
39
export const isCompare = ( ) : boolean => / ^ c o m p a r e / . test ( getRepoPath ( ) ! ) ;
40
- export const isCompareTest = [
40
+ export const _isCompare = [
41
41
'https://github.com/sindresorhus/refined-github/compare' ,
42
42
'https://github.com/sindresorhus/refined-github/compare/' ,
43
43
'https://github.com/sindresorhus/refined-github/compare/master...branch-name' ,
@@ -47,7 +47,7 @@ export const isCompareTest = [
47
47
] ;
48
48
49
49
export const isDashboard = ( ) : boolean => ! isGist ( ) && / ^ $ | ^ ( o r g s [ / ] [ ^ / ] + [ / ] ) ? d a s h b o a r d ( [ / ] | $ ) / . test ( getCleanPathname ( ) ) ;
50
- export const isDashboardTest = [
50
+ export const _isDashboard = [
51
51
'https://github.com/' ,
52
52
'https://github.com' ,
53
53
'https://github.com/orgs/test/dashboard' ,
@@ -60,23 +60,23 @@ export const isDashboardTest = [
60
60
] ;
61
61
62
62
export const isEnterprise = ( ) : boolean => location . hostname !== 'github.com' && location . hostname !== 'gist.github.com' ;
63
- export const isEnterpriseTest = [
63
+ export const _isEnterprise = [
64
64
'https://github.big-corp.com/' ,
65
65
'https://not-github.com/' ,
66
66
'https://my-little-hub.com/' ,
67
67
'https://my-little-hub.com/gist'
68
68
] ;
69
69
70
70
export const isGist = ( ) : boolean => location . hostname . startsWith ( 'gist.' ) || location . pathname . split ( '/' , 2 ) [ 1 ] === 'gist' ;
71
- export const isGistTest = [
71
+ export const _isGist = [
72
72
'https://gist.github.com' ,
73
73
'http://gist.github.com' ,
74
74
'https://gist.github.com/sindresorhus/0ea3c2845718a0a0f0beb579ff14f064' ,
75
75
'https://my-little-hub.com/gist'
76
76
] ;
77
77
78
78
export const isGlobalDiscussionList = ( ) : boolean => [ 'issues' , 'pulls' ] . includes ( location . pathname . split ( '/' , 2 ) [ 1 ] ) ;
79
- export const isGlobalDiscussionListTest = [
79
+ export const _isGlobalDiscussionList = [
80
80
'https://github.com/issues' ,
81
81
'https://github.com/issues?q=is%3Apr+is%3Aopen' ,
82
82
'https://github.com/issues/assigned' ,
@@ -89,75 +89,75 @@ export const isGlobalDiscussionListTest = [
89
89
] ;
90
90
91
91
export const isGlobalSearchResults = ( ) : boolean => location . pathname === '/search' && new URLSearchParams ( location . search ) . get ( 'q' ) !== null ;
92
- export const isGlobalSearchResultsTest = [
92
+ export const _isGlobalSearchResults = [
93
93
'https://github.com/search?q=refined-github&ref=opensearch'
94
94
] ;
95
95
96
96
export const isIssue = ( ) : boolean => / ^ i s s u e s \/ \d + / . test ( getRepoPath ( ) ! ) ;
97
- export const isIssueTest = [
97
+ export const _isIssue = [
98
98
'https://github.com/sindresorhus/refined-github/issues/146'
99
99
] ;
100
100
101
101
export const isDiscussionList = ( ) : boolean => isGlobalDiscussionList ( ) || isRepoDiscussionList ( ) ;
102
- export const isDiscussionListTest = skip ;
102
+ export const _isDiscussionList = skip ;
103
103
104
104
export const isLabelList = ( ) : boolean => getRepoPath ( ) === 'labels' ;
105
- export const isLabelListTest = [
105
+ export const _isLabelList = [
106
106
'https://github.com/sindresorhus/refined-github/labels'
107
107
] ;
108
108
109
109
export const isMilestone = ( ) : boolean => / ^ m i l e s t o n e \/ \d + / . test ( getRepoPath ( ) ! ) ;
110
- export const isMilestoneTest = [
110
+ export const _isMilestone = [
111
111
'https://github.com/sindresorhus/refined-github/milestone/12'
112
112
] ;
113
113
114
114
export const isMilestoneList = ( ) : boolean => getRepoPath ( ) === 'milestones' ;
115
- export const isMilestoneListTest = [
115
+ export const _isMilestoneList = [
116
116
'https://github.com/sindresorhus/refined-github/milestones'
117
117
] ;
118
118
119
119
export const isNewIssue = ( ) : boolean => / ^ i s s u e s \/ n e w / . test ( getRepoPath ( ) ! ) ;
120
- export const isNewIssueTest = [
120
+ export const _isNewIssue = [
121
121
'https://github.com/sindresorhus/refined-github/issues/new'
122
122
] ;
123
123
124
124
export const isNewRelease = ( ) : boolean => / ^ r e l e a s e s \/ n e w / . test ( getRepoPath ( ) ! ) ;
125
- export const isNewReleaseTest = [
125
+ export const _isNewRelease = [
126
126
'https://github.com/sindresorhus/refined-github/releases/new'
127
127
] ;
128
128
129
129
export const isNotifications = ( ) : boolean => / ^ ( [ ^ / ] + [ / ] [ ^ / ] + \/ ) ? n o t i f i c a t i o n s / . test ( getCleanPathname ( ) ) ;
130
- export const isNotificationsTest = [
130
+ export const _isNotifications = [
131
131
'https://github.com/notifications' ,
132
132
'https://github.com/notifications/participating' ,
133
133
'https://github.com/sindresorhus/notifications/notifications' ,
134
134
'https://github.com/notifications?all=1'
135
135
] ;
136
136
137
137
export const isOrganizationProfile = ( ) : boolean => select . exists ( '.orghead' ) ;
138
- export const isOrganizationProfileTest = domBased ;
138
+ export const _isOrganizationProfile = domBased ;
139
139
140
140
export const isOrganizationDiscussion = ( ) : boolean => / ^ o r g s \/ [ ^ / ] + \/ t e a m s \/ [ ^ / ] + ( $ | \/ d i s c u s s i o n s ) / . test ( getCleanPathname ( ) ) ;
141
- export const isOrganizationDiscussionTest = [
141
+ export const _isOrganizationDiscussion = [
142
142
'https://github.com/orgs/refined-github/teams/core-team/discussions?pinned=1' ,
143
143
'https://github.com/orgs/refined-github/teams/core-team/discussions/1' ,
144
144
'https://github.com/orgs/refined-github/teams/core-team'
145
145
] ;
146
146
147
147
export const isOwnUserProfile = ( ) : boolean => getCleanPathname ( ) === getUsername ( ) ;
148
- export const isOwnUserProfileTest = domBased ;
148
+ export const _isOwnUserProfile = domBased ;
149
149
150
150
// If there's a Report Abuse link, we're not part of the org
151
151
export const isOwnOrganizationProfile = ( ) : boolean => isOrganizationProfile ( ) && ! select . exists ( '[href*="contact/report-abuse?report="]' ) ;
152
- export const isOwnOrganizationProfileTest = domBased ;
152
+ export const _isOwnOrganizationProfile = domBased ;
153
153
154
154
export const isProject = ( ) : boolean => / ^ p r o j e c t s \/ \d + / . test ( getRepoPath ( ) ! ) ;
155
- export const isProjectTest = [
155
+ export const _isProject = [
156
156
'https://github.com/sindresorhus/refined-github/projects/3'
157
157
] ;
158
158
159
159
export const isPR = ( ) : boolean => / ^ p u l l \/ \d + / . test ( getRepoPath ( ) ! ) ;
160
- export const isPRTest = [
160
+ export const _isPR = [
161
161
'https://github.com/sindresorhus/refined-github/pull/148' ,
162
162
'https://github.com/sindresorhus/refined-github/pull/148/files' ,
163
163
'https://github.com/sindresorhus/refined-github/pull/148/conflicts' ,
@@ -166,12 +166,12 @@ export const isPRTest = [
166
166
] ;
167
167
168
168
export const isConflict = ( ) : boolean => / ^ p u l l \/ \d + \/ c o n f l i c t s / . test ( getRepoPath ( ) ! ) ;
169
- export const isConflictTest = [
169
+ export const _isConflict = [
170
170
'https://github.com/sindresorhus/refined-github/pull/148/conflicts'
171
171
] ;
172
172
173
173
export const isPRList = ( ) : boolean => location . pathname === '/pulls' || getRepoPath ( ) === 'pulls' ;
174
- export const isPRListTest = [
174
+ export const _isPRList = [
175
175
'https://github.com/pulls' ,
176
176
'https://github.com/pulls?q=issues' ,
177
177
'https://github.com/sindresorhus/refined-github/pulls' ,
@@ -181,23 +181,23 @@ export const isPRListTest = [
181
181
] ;
182
182
183
183
export const isPRCommit = ( ) : boolean => / ^ p u l l \/ \d + \/ c o m m i t s \/ [ 0 - 9 a - f ] { 5 , 40 } / . test ( getRepoPath ( ) ! ) ;
184
- export const isPRCommitTest = [
184
+ export const _isPRCommit = [
185
185
'https://github.com/sindresorhus/refined-github/pull/148/commits/0019603b83bd97c2f7ef240969f49e6126c5ec85' ,
186
186
'https://github.com/sindresorhus/refined-github/pull/148/commits/00196'
187
187
] ;
188
188
189
189
export const isPRConversation = ( ) : boolean => / ^ p u l l \/ \d + $ / . test ( getRepoPath ( ) ! ) ;
190
- export const isPRConversationTest = [
190
+ export const _isPRConversation = [
191
191
'https://github.com/sindresorhus/refined-github/pull/148'
192
192
] ;
193
193
194
194
export const isPRFiles = ( ) : boolean => / ^ p u l l \/ \d + \/ f i l e s / . test ( getRepoPath ( ) ! ) ;
195
- export const isPRFilesTest = [
195
+ export const _isPRFiles = [
196
196
'https://github.com/sindresorhus/refined-github/pull/148/files'
197
197
] ;
198
198
199
199
export const isQuickPR = ( ) : boolean => isCompare ( ) && / [ ? & ] q u i c k _ p u l l = 1 ( & | $ ) / . test ( location . search ) ;
200
- export const isQuickPRTest = [
200
+ export const _isQuickPR = [
201
201
'https://github.com/sindresorhus/refined-github/compare/master...branch-name?quick_pull=1' ,
202
202
'https://github.com/sindresorhus/refined-github/compare/branch-1...branch-2?quick_pull=1' ,
203
203
'https://github.com/sindresorhus/refined-github/compare/test-branch?quick_pull=1'
@@ -208,15 +208,15 @@ export const isReleasesOrTags = (): boolean => {
208
208
return / ^ ( r e l e a s e s | t a g s ) $ / . test ( parts [ 0 ] ) && parts [ 1 ] !== 'new' ;
209
209
} ;
210
210
211
- export const isReleasesOrTagsTest = [
211
+ export const _isReleasesOrTags = [
212
212
'https://github.com/sindresorhus/refined-github/releases' ,
213
213
'https://github.com/sindresorhus/refined-github/tags' ,
214
214
'https://github.com/sindresorhus/refined-github/releases/tag/v1.0.0-beta.4' ,
215
215
'https://github.com/sindresorhus/refined-github/releases/tag/0.2.1'
216
216
] ;
217
217
218
218
export const isEditingFile = ( ) : boolean => / ^ e d i t / . test ( getRepoPath ( ) ! ) ;
219
- export const isEditingFileTest = [
219
+ export const _isEditingFile = [
220
220
'https://github.com/sindresorhus/refined-github/edit/master/readme.md' ,
221
221
'https://github.com/sindresorhus/refined-github/edit/ghe-injection/source/background.ts'
222
222
] ;
@@ -227,19 +227,19 @@ export const isRepo = (): boolean => /^[^/]+\/[^/]+/.test(getCleanPathname()) &&
227
227
! isDashboard ( ) &&
228
228
! isGist ( ) &&
229
229
! isRepoSearch ( ) ;
230
- export const isRepoTest = [
230
+ export const _isRepo = [
231
231
'https://github.com/sindresorhus/refined-github/blame/master/package.json' ,
232
232
'https://github.com/sindresorhus/refined-github/issues/146' ,
233
233
'https://github.com/sindresorhus/notifications/' ,
234
234
'https://github.com/sindresorhus/refined-github/pull/148'
235
235
] ;
236
- export const isRepoTestSkipNegatives = true ;
236
+ export const _isRepoSkipNegatives = true ;
237
237
238
238
export const isRepoDiscussionList = ( ) : boolean =>
239
239
isRepoPRList ( ) ||
240
240
isRepoIssueList ( ) ||
241
241
/ ^ l a b e l s \/ .+ / . test ( getRepoPath ( ) ! ) ;
242
- export const isRepoDiscussionListTest = [
242
+ export const _isRepoDiscussionList = [
243
243
'http://github.com/sindresorhus/ava/issues' ,
244
244
'https://github.com/sindresorhus/refined-github/pulls' ,
245
245
'https://github.com/sindresorhus/refined-github/pulls/' ,
@@ -253,7 +253,7 @@ export const isRepoDiscussionListTest = [
253
253
] ;
254
254
255
255
export const isRepoPRList = ( ) : boolean => ( getRepoPath ( ) || '' ) . startsWith ( 'pulls' ) ;
256
- export const isRepoPRListTest = [
256
+ export const _isRepoPRList = [
257
257
'https://github.com/sindresorhus/refined-github/pulls' ,
258
258
'https://github.com/sindresorhus/refined-github/pulls/' ,
259
259
'https://github.com/sindresorhus/refined-github/pulls/fregante' ,
@@ -266,15 +266,15 @@ export const isRepoIssueList = (): boolean => {
266
266
return parts [ 0 ] === 'issues' && parts [ 1 ] !== 'new' && ! / \d / . test ( parts [ 1 ] ) ; // `issues/fregante` is a list but `issues/1` isn't
267
267
} ;
268
268
269
- export const isRepoIssueListTest = [
269
+ export const _isRepoIssueList = [
270
270
'http://github.com/sindresorhus/ava/issues' ,
271
271
'https://github.com/sindresorhus/refined-github/issues' ,
272
272
'https://github.com/sindresorhus/refined-github/issues/fregante' ,
273
273
'https://github.com/sindresorhus/refined-github/issues?q=is%3Aclosed+sort%3Aupdated-desc'
274
274
] ;
275
275
276
276
export const isRepoRoot = ( ) : boolean => / ^ ( t r e e [ / ] [ ^ / ] + ) ? $ / . test ( getRepoPath ( ) ! ) ;
277
- export const isRepoRootTest = [
277
+ export const _isRepoRoot = [
278
278
// Some tests are here only as "gotchas" for other tests that may misidentify their pages
279
279
'https://github.com/sindresorhus/edit' ,
280
280
'https://github.com/sindresorhus/search' ,
@@ -291,71 +291,71 @@ export const isRepoRootTest = [
291
291
] ;
292
292
293
293
export const isRepoSearch = ( ) : boolean => location . pathname . slice ( 1 ) . split ( '/' ) [ 2 ] === 'search' ;
294
- export const isRepoSearchTest = [
294
+ export const _isRepoSearch = [
295
295
'https://github.com/sindresorhus/refined-github/search?q=diff' ,
296
296
'https://github.com/sindresorhus/refined-github/search?q=diff&unscoped_q=diff&type=Issues' ,
297
297
'https://github.com/sindresorhus/refined-github/search'
298
298
] ;
299
299
300
300
export const isRepoSettings = ( ) : boolean => / ^ s e t t i n g s / . test ( getRepoPath ( ) ! ) ;
301
- export const isRepoSettingsTest = [
301
+ export const _isRepoSettings = [
302
302
'https://github.com/sindresorhus/refined-github/settings' ,
303
303
'https://github.com/sindresorhus/refined-github/settings/branches'
304
304
] ;
305
305
306
306
export const isRepoTree = ( ) : boolean => isRepoRoot ( ) || / ^ t r e e \/ / . test ( getRepoPath ( ) ! ) ;
307
- export const isRepoTreeTest = [
307
+ export const _isRepoTree = [
308
308
'https://github.com/sindresorhus/refined-github/tree/master/distribution' ,
309
309
'https://github.com/sindresorhus/refined-github/tree/0.13.0/distribution' ,
310
310
'https://github.com/sindresorhus/refined-github/tree/57bf435ee12d14b482df0bbd88013a2814c7512e/distribution'
311
- ] . concat ( isRepoRootTest ) ;
311
+ ] . concat ( _isRepoRoot ) ;
312
312
313
313
export const isRepoWithAccess = ( ) : boolean => isRepo ( ) && select . exists ( '.reponav-item[href$="/settings"]' ) ;
314
- export const isRepoWithAccessTest = domBased ;
314
+ export const _isRepoWithAccess = domBased ;
315
315
316
316
export const isSingleCommit = ( ) : boolean => / ^ c o m m i t \/ [ 0 - 9 a - f ] { 5 , 40 } / . test ( getRepoPath ( ) ! ) ;
317
- export const isSingleCommitTest = [
317
+ export const _isSingleCommit = [
318
318
'https://github.com/sindresorhus/refined-github/commit/5b614b9035f2035b839f48b4db7bd5c3298d526f' ,
319
319
'https://github.com/sindresorhus/refined-github/commit/5b614'
320
320
] ;
321
321
322
322
export const isSingleFile = ( ) : boolean => / ^ b l o b \/ / . test ( getRepoPath ( ) ! ) ;
323
- export const isSingleFileTest = [
323
+ export const _isSingleFile = [
324
324
'https://github.com/sindresorhus/refined-github/blob/master/.gitattributes' ,
325
325
'https://github.com/sindresorhus/refined-github/blob/fix-narrow-diff/distribution/content.css' ,
326
326
'https://github.com/sindresorhus/refined-github/blob/master/edit.txt'
327
327
] ;
328
328
329
329
export const isTrending = ( ) : boolean => location . pathname === '/trending' || location . pathname . startsWith ( '/trending/' ) ;
330
- export const isTrendingTest = [
330
+ export const _isTrending = [
331
331
'https://github.com/trending' ,
332
332
'https://github.com/trending/developers' ,
333
333
'https://github.com/trending/unknown'
334
334
] ;
335
335
336
336
export const isUserProfile = ( ) : boolean => select . exists ( '.user-profile-nav' ) ;
337
- export const isUserProfileTest = domBased ;
337
+ export const _isUserProfile = domBased ;
338
338
339
339
export const isSingleTagPage = ( ) : boolean => / ^ ( r e l e a s e s \/ t a g ) / . test ( getRepoPath ( ) ! ) ;
340
- export const isSingleTagPageTest = [
340
+ export const _isSingleTagPage = [
341
341
'https://github.com/sindresorhus/refined-github/releases/tag/v1.0.0-beta.4' ,
342
342
'https://github.com/sindresorhus/refined-github/releases/tag/0.2.1'
343
343
] ;
344
344
345
- export const hasCommentsTest = skip ;
345
+ export const _hasComments = skip ;
346
346
export const hasComments = ( ) : boolean =>
347
347
isPR ( ) ||
348
348
isIssue ( ) ||
349
349
isCommit ( ) ||
350
350
isOrganizationDiscussion ( ) ;
351
351
352
- export const hasRichTextEditorTest = skip ;
352
+ export const _hasRichTextEditor = skip ;
353
353
export const hasRichTextEditor = ( ) : boolean =>
354
354
hasComments ( ) ||
355
355
isNewIssue ( ) ||
356
356
isCompare ( ) ;
357
357
358
- export const hasCodeTest = skip ;
358
+ export const _hasCode = skip ;
359
359
export const hasCode = ( ) : boolean => // Static code, not the editor
360
360
hasComments ( ) ||
361
361
isRepoTree ( ) || // Readme files
0 commit comments