@ -219,4 +219,62 @@ describe("URL resolution", () => {
expect ( resolveUrl ( url , conf ) ) . toEqual ( url ) ;
} ) ;
describe ( "remote root replacement" , ( ) => {
it ( "Does not replace remote root when no remote root defined" , ( ) => {
let conf = {
projectFile : "/home/user/projects/foo/.indium.json"
} ;
let path = "/home/user/projects/foo/bar.js" ;
expect ( resolveUrl ( path , conf ) ) . toEqual ( path ) ;
} ) ;
it ( "Replaces remote root when defined" , ( ) => {
let conf = {
projectFile : "/home/user/projects/foo/.indium.json" ,
remoteRoot : "/var/task/"
} ;
let path = "/var/task/bar.js" ;
expect ( resolveUrl ( path , conf ) ) . toEqual ( "/home/user/projects/foo/bar.js" ) ;
} ) ;
it ( "Replaces local root with remote root when defined" , ( ) => {
let conf = {
projectFile : "/home/user/projects/foo/.indium.json" ,
root : "bar" ,
remoteRoot : "/var/task/"
} ;
let path = "/var/task/baz.js" ;
expect ( resolveUrl ( path , conf ) ) . toEqual ( "/home/user/projects/foo/bar/baz.js" ) ;
} ) ;
it ( "Replaces remote root with no trailing slash" , ( ) => {
let conf = {
projectFile : "/home/user/projects/foo/.indium.json" ,
remoteRoot : "/var/task"
} ;
let path = "/var/task/bar/baz.js" ;
expect ( resolveUrl ( path , conf ) ) . toEqual ( "/home/user/projects/foo/bar/baz.js" ) ;
} ) ;
it ( "Replaces remote root with file:// protocol" , ( ) => {
let conf = {
projectFile : "/home/user/projects/foo/.indium.json" ,
remoteRoot : "/var/task/"
} ;
let path = "/var/task/bar.js" ;
expect ( resolveUrl ( path , conf ) ) . toEqual ( "/home/user/projects/foo/bar.js" ) ;
} ) ;
} ) ;
} ) ;