@@ -535,7 +535,7 @@ describe('ResourceMapper', () => {
535535
536536 itMapsFile ( mapper , 'a file on a host' ,
537537 {
538- path : `${ rootPath } space/foo.html` ,
538+ path : `${ rootPath } example.org/ space/foo.html` ,
539539 hostname : 'example.org'
540540 } ,
541541 {
@@ -550,7 +550,7 @@ describe('ResourceMapper', () => {
550550
551551 itMapsFile ( mapper , 'a file on a host' ,
552552 {
553- path : `${ rootPath } space/foo.html` ,
553+ path : `${ rootPath } example.org/ space/foo.html` ,
554554 hostname : 'example.org'
555555 } ,
556556 {
@@ -564,10 +564,11 @@ describe('ResourceMapper', () => {
564564
565565 itMapsFile ( mapper , 'a file with the port' ,
566566 {
567- path : `${ rootPath } space/foo.html`
567+ path : `${ rootPath } example.org/space/foo.html` ,
568+ hostname : 'example.org'
568569 } ,
569570 {
570- url : 'http://localhost:81/space/foo.html' ,
571+ url : 'http://localhost:81/example.org/ space/foo.html' ,
571572 contentType : 'text/html'
572573 } )
573574 } )
@@ -577,7 +578,7 @@ describe('ResourceMapper', () => {
577578
578579 itMapsFile ( mapper , 'a file with the port' ,
579580 {
580- path : `${ rootPath } space/foo.html` ,
581+ path : `${ rootPath } example.org/ space/foo.html` ,
581582 hostname : 'example.org'
582583 } ,
583584 {
@@ -591,10 +592,11 @@ describe('ResourceMapper', () => {
591592
592593 itMapsFile ( mapper , 'a file with the port' ,
593594 {
594- path : `${ rootPath } space/foo.html`
595+ path : `${ rootPath } example.org/space/foo.html` ,
596+ hostname : 'example.org'
595597 } ,
596598 {
597- url : 'https://localhost:81/space/foo.html' ,
599+ url : 'https://localhost:81/example.org/ space/foo.html' ,
598600 contentType : 'text/html'
599601 } )
600602 } )
@@ -604,14 +606,25 @@ describe('ResourceMapper', () => {
604606
605607 itMapsFile ( mapper , 'a file with the port' ,
606608 {
607- path : `${ rootPath } space/foo.html` ,
609+ path : `${ rootPath } example.org/ space/foo.html` ,
608610 hostname : 'example.org'
609611 } ,
610612 {
611613 url : 'https://example.org:81/space/foo.html' ,
612614 contentType : 'text/html'
613615 } )
614616 } )
617+
618+ describe ( 'A ResourceMapper instance for an HTTPS host with non-default port in a multi-host setup' , ( ) => {
619+ const mapper = new ResourceMapper ( { rootUrl : 'https://localhost:81/' , rootPath, includeHost : true } )
620+
621+ it ( 'throws an error when there is an improper file path' , ( ) => {
622+ return expect ( mapper . mapFileToUrl ( {
623+ path : `${ rootPath } example.orgspace/foo.html` ,
624+ hostname : 'example.org'
625+ } ) ) . to . be . rejectedWith ( Error , 'Path must start with hostname (/example.org)' )
626+ } )
627+ } )
615628} )
616629
617630function asserter ( assert ) {
0 commit comments