File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -95,3 +95,48 @@ test('is500', t => {
95
95
document . title = 'Server Error · Issue #266 · sintaxi/surge · GitHub' ;
96
96
t . false ( pageDetect . is500 ( ) ) ;
97
97
} ) ;
98
+
99
+ test ( 'getRepoPath' , t => {
100
+ const pairs = new Map < string , string | undefined > ( [
101
+ [
102
+ 'https://github.com' ,
103
+ undefined ,
104
+ ] ,
105
+ [
106
+ 'https://gist.github.com/' ,
107
+ undefined ,
108
+ ] ,
109
+ [
110
+ 'https://github.com/settings/developers' ,
111
+ undefined ,
112
+ ] ,
113
+ [
114
+ 'https://github.com/sindresorhus/refined-github' ,
115
+ '' ,
116
+ ] ,
117
+ [
118
+ 'https://github.com/sindresorhus/refined-github/' ,
119
+ '' ,
120
+ ] ,
121
+ [
122
+ 'https://github.com/sindresorhus/refined-github/blame/master/package.json' ,
123
+ 'blame/master/package.json' ,
124
+ ] ,
125
+ [
126
+ 'https://github.com/sindresorhus/refined-github/commit/57bf4' ,
127
+ 'commit/57bf4' ,
128
+ ] ,
129
+ [
130
+ 'https://github.com/sindresorhus/refined-github/compare/test-branch?quick_pull=0' ,
131
+ 'compare/test-branch' ,
132
+ ] ,
133
+ [
134
+ 'https://github.com/sindresorhus/refined-github/tree/master/distribution' ,
135
+ 'tree/master/distribution' ,
136
+ ] ,
137
+ ] ) ;
138
+
139
+ for ( const [ url , result ] of pairs ) {
140
+ t . is ( result , pageDetect . utils . getRepoPath ( new URL ( url ) ) ) ;
141
+ }
142
+ } ) ;
You can’t perform that action at this time.
0 commit comments