@@ -31,6 +31,39 @@ describe('getURLLookupAlternatives', () => {
3131 } ,
3232 ] ,
3333 } ) ;
34+
35+ expect ( getURLLookupAlternatives ( new URL ( 'https://docs.mycompany.com/a/b/c/d' ) ) ) . toEqual ( {
36+ revision : undefined ,
37+ changeRequest : undefined ,
38+ basePath : undefined ,
39+ urls : [
40+ {
41+ extraPath : 'a/b/c/d' ,
42+ url : 'https://docs.mycompany.com/' ,
43+ primary : false ,
44+ } ,
45+ {
46+ extraPath : 'b/c/d' ,
47+ url : 'https://docs.mycompany.com/a' ,
48+ primary : false ,
49+ } ,
50+ {
51+ extraPath : 'c/d' ,
52+ url : 'https://docs.mycompany.com/a/b' ,
53+ primary : false ,
54+ } ,
55+ {
56+ extraPath : 'd' ,
57+ url : 'https://docs.mycompany.com/a/b/c' ,
58+ primary : false ,
59+ } ,
60+ {
61+ extraPath : '' ,
62+ url : 'https://docs.mycompany.com/a/b/c/d' ,
63+ primary : true ,
64+ } ,
65+ ] ,
66+ } ) ;
3467 } ) ;
3568
3669 it ( 'should not match before the variant for a variant url' , ( ) => {
@@ -216,29 +249,34 @@ describe('getURLLookupAlternatives', () => {
216249 } ) ;
217250
218251 it ( 'should limit depth' , ( ) => {
219- expect ( getURLLookupAlternatives ( new URL ( 'https://docs.mycompany.com/a/b/c/d' ) ) ) . toEqual ( {
252+ expect ( getURLLookupAlternatives ( new URL ( 'https://docs.mycompany.com/a/b/c/d/e ' ) ) ) . toEqual ( {
220253 revision : undefined ,
221254 changeRequest : undefined ,
222255 basePath : undefined ,
223256 urls : [
224257 {
225- extraPath : 'a/b/c/d' ,
258+ extraPath : 'a/b/c/d/e ' ,
226259 url : 'https://docs.mycompany.com/' ,
227260 primary : false ,
228261 } ,
229262 {
230- extraPath : 'b/c/d' ,
263+ extraPath : 'b/c/d/e ' ,
231264 url : 'https://docs.mycompany.com/a' ,
232265 primary : false ,
233266 } ,
234267 {
235- extraPath : 'c/d' ,
268+ extraPath : 'c/d/e ' ,
236269 url : 'https://docs.mycompany.com/a/b' ,
237270 primary : false ,
238271 } ,
239272 {
240- extraPath : 'd' ,
273+ extraPath : 'd/e ' ,
241274 url : 'https://docs.mycompany.com/a/b/c' ,
275+ primary : false ,
276+ } ,
277+ {
278+ extraPath : 'e' ,
279+ url : 'https://docs.mycompany.com/a/b/c/d' ,
242280 primary : true ,
243281 } ,
244282 ] ,
@@ -269,7 +307,12 @@ describe('getURLLookupAlternatives', () => {
269307 {
270308 extraPath : 'c/d' ,
271309 url : 'https://docs.mycompany.com/a/~/b' ,
310+ primary : false ,
311+ } ,
312+ {
313+ extraPath : 'd' ,
272314 primary : true ,
315+ url : 'https://docs.mycompany.com/a/~/b/c' ,
273316 } ,
274317 ] ,
275318 } ) ;
0 commit comments