@@ -19,7 +19,7 @@ public void HrefShouldResolveCorrectly(string href, string book, string language
1919 BookUrlName = book ,
2020 BooksXmlFolder = Path . GetFullPath ( "../xml" , bookDir ) ,
2121 SourceFolder = bookDir ,
22- OutputFolder = Path . GetFullPath ( "../../../../artifacts/tests/public_html" + book , AppContext . BaseDirectory ) ,
22+ OutputFolder = Path . GetFullPath ( "../../../../artifacts/tests/public_html/ " + book , AppContext . BaseDirectory ) ,
2323 } ;
2424
2525 var resolver = new DocToStaticPagesResourceResolver ( args )
@@ -31,4 +31,29 @@ public void HrefShouldResolveCorrectly(string href, string book, string language
3131 Assert . Equal ( expectedUrl , result ) ;
3232 Assert . Equal ( expectedTitle , title ) ;
3333 }
34+
35+ [ Theory ]
36+ [ InlineData ( "../images/A/a.jpg" , "app" , "en" , "A/App" , false , "/app/en/images/A/a.jpg" ) ]
37+ [ InlineData ( "../images/A/a.jpg?v=123" , "app" , "en" , "A/App" , false , "/app/en/images/A/a.jpg?v=123" ) ]
38+ [ InlineData ( "../images/A/a.jpg?v=123" , "app" , "en" , "A/App" , true , "/app/en/images/A/a.webp?v=123" ) ]
39+ public void SrcShouldResolveCorrectly ( string src , string book , string language , string sourceDir , bool useWebp , string expectedUrl )
40+ {
41+ var bookDir = Path . GetFullPath ( "../../../../converter/tests/books/" + book , AppContext . BaseDirectory ) ;
42+ var args = new DocToStaticPagesTransformerArgs
43+ {
44+ BookUrlName = book ,
45+ BooksXmlFolder = Path . GetFullPath ( "../xml" , bookDir ) ,
46+ SourceFolder = bookDir ,
47+ OutputFolder = Path . GetFullPath ( "../../../../artifacts/tests/public_html/" + book , AppContext . BaseDirectory ) ,
48+ UseWebp = useWebp ,
49+ } ;
50+
51+ var resolver = new DocToStaticPagesResourceResolver ( args )
52+ {
53+ Language = language
54+ } ;
55+
56+ Assert . True ( resolver . TryResolveSrc ( src , Path . Combine ( bookDir , language , sourceDir ) , out var result , out _ ) ) ;
57+ Assert . Equal ( expectedUrl , result ) ;
58+ }
3459}
0 commit comments