File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -484,5 +484,30 @@ describe('buildRequest - OpenAPI Specification 3.0', function () {
484484
485485 expect ( res ) . toEqual ( 'https://petstore.com' )
486486 } )
487+ it ( 'should fall back to contextUrls if no servers are provided' , function ( ) {
488+ const spec = {
489+ openapi : '3.0.0'
490+ }
491+
492+ const res = baseUrl ( {
493+ spec,
494+ server : 'http://some-invalid-server.com/' ,
495+ contextUrl : 'http://google.com/'
496+ } )
497+
498+ expect ( res ) . toEqual ( 'http://google.com' )
499+ } )
500+ it ( 'should return an empty string if no servers or contextUrl are provided' , function ( ) {
501+ const spec = {
502+ openapi : '3.0.0'
503+ }
504+
505+ const res = baseUrl ( {
506+ spec,
507+ server : 'http://some-invalid-server.com/'
508+ } )
509+
510+ expect ( res ) . toEqual ( '' )
511+ } )
487512 } )
488513} )
You can’t perform that action at this time.
0 commit comments