@@ -288,3 +288,69 @@ test("It moves specification ID to version ID if needed", () => {
288288 expect ( sut . version ! . id ) . toEqual ( "bar/baz" )
289289 expect ( sut . specification ! . id ) . toEqual ( "hello" )
290290} )
291+
292+ test ( "It supports specifications with spaces in their names" , ( ) => {
293+ const sut = getProjectSelectionFromPath ( {
294+ path : "/acme/foo/main/openapi with spaces.yml" ,
295+ projects : [
296+ {
297+ id : 'acme-foo' ,
298+ name : 'foo' ,
299+ displayName : "Ulrik's Playground" ,
300+ versions : [ {
301+ id : 'main' ,
302+ name : 'main' ,
303+ specifications : [ {
304+ id : "openapi with spaces.yml" ,
305+ name : "openapi with spaces.yml" ,
306+ url : "/api/blob/acme/foo-openapi/openapi with spaces.yml?ref=3dbafacbe57ac931ee750fc973bad3c81c9765bb" ,
307+ editURL : "https://github.com/acme/foo-openapi/edit/main/openapi with spaces.yml"
308+ } ] ,
309+ url : 'https://github.com/acme/foo-openapi/tree/main' ,
310+ isDefault : true
311+ } ] ,
312+ imageURL : '/api/blob/acme/foo-openapi/icon.png?ref=3dbafacbe57ac931ee750fc973bad3c81c9765bb' ,
313+ url : 'https://github.com/acme/foo-openapi' ,
314+ owner : 'acme' ,
315+ ownerUrl : 'https://github.com/acme'
316+ }
317+ ]
318+ } )
319+ expect ( sut . project ! . owner ) . toEqual ( "acme" )
320+ expect ( sut . project ! . name ) . toEqual ( "foo" )
321+ expect ( sut . version ! . id ) . toEqual ( "main" )
322+ expect ( sut . specification ! . id ) . toEqual ( "openapi with spaces.yml" )
323+ } )
324+
325+ test ( "It supports specifications with URL-encoded spaces in their names" , ( ) => {
326+ const sut = getProjectSelectionFromPath ( {
327+ path : "/acme/foo/main/openapi%20with%20spaces.yml" ,
328+ projects : [
329+ {
330+ id : 'acme-foo' ,
331+ name : 'foo' ,
332+ displayName : "Ulrik's Playground" ,
333+ versions : [ {
334+ id : 'main' ,
335+ name : 'main' ,
336+ specifications : [ {
337+ id : "openapi with spaces.yml" ,
338+ name : "openapi with spaces.yml" ,
339+ url : "/api/blob/acme/foo-openapi/openapi with spaces.yml?ref=3dbafacbe57ac931ee750fc973bad3c81c9765bb" ,
340+ editURL : "https://github.com/acme/foo-openapi/edit/main/openapi with spaces.yml"
341+ } ] ,
342+ url : 'https://github.com/acme/foo-openapi/tree/main' ,
343+ isDefault : true
344+ } ] ,
345+ imageURL : '/api/blob/acme/foo-openapi/icon.png?ref=3dbafacbe57ac931ee750fc973bad3c81c9765bb' ,
346+ url : 'https://github.com/acme/foo-openapi' ,
347+ owner : 'acme' ,
348+ ownerUrl : 'https://github.com/acme'
349+ }
350+ ]
351+ } )
352+ expect ( sut . project ! . owner ) . toEqual ( "acme" )
353+ expect ( sut . project ! . name ) . toEqual ( "foo" )
354+ expect ( sut . version ! . id ) . toEqual ( "main" )
355+ expect ( sut . specification ! . id ) . toEqual ( "openapi with spaces.yml" )
356+ } )
0 commit comments