@@ -602,14 +602,30 @@ mod tests {
602
602
async fn create_mock_avatar_server ( ) -> ServerGuard {
603
603
let mut server = Server :: new_async ( ) . await ;
604
604
605
- // Mock for successful avatar download
605
+ // Mock for successful PNG avatar download
606
606
server
607
607
. mock ( "GET" , "/test-avatar.png" )
608
608
. with_status ( 200 )
609
609
. with_header ( "content-type" , "image/png" )
610
610
. with_body ( include_bytes ! ( "../template/assets/test-avatar.png" ) )
611
611
. create ( ) ;
612
612
613
+ // Mock for JPEG avatar download
614
+ server
615
+ . mock ( "GET" , "/test-avatar.jpg" )
616
+ . with_status ( 200 )
617
+ . with_header ( "content-type" , "image/jpeg" )
618
+ . with_body ( include_bytes ! ( "../template/assets/test-avatar.jpg" ) )
619
+ . create ( ) ;
620
+
621
+ // Mock for unsupported file type (WebP)
622
+ server
623
+ . mock ( "GET" , "/test-avatar.webp" )
624
+ . with_status ( 200 )
625
+ . with_header ( "content-type" , "image/webp" )
626
+ . with_body ( include_bytes ! ( "../template/assets/test-avatar.webp" ) )
627
+ . create ( ) ;
628
+
613
629
// Mock for 404 avatar download
614
630
server
615
631
. mock ( "GET" , "/missing-avatar.png" )
@@ -677,16 +693,21 @@ mod tests {
677
693
}
678
694
679
695
fn create_overflow_authors ( server_url : & str ) -> Vec < OgImageAuthorData < ' _ > > {
680
- let avatar_url = format ! ( "{server_url}/test-avatar.png" ) ;
681
696
vec ! [
682
- author_with_avatar( "alice-wonderland" , avatar_url . clone ( ) ) ,
697
+ author_with_avatar( "alice-wonderland" , format! ( "{server_url}/test-avatar.png" ) ) ,
683
698
author( "bob-the-builder" ) ,
684
- author_with_avatar( "charlie-brown" , avatar_url . clone ( ) ) ,
699
+ author_with_avatar( "charlie-brown" , format! ( "{server_url}/test-avatar.jpg" ) ) ,
685
700
author( "diana-prince" ) ,
686
- author_with_avatar( "edward-scissorhands" , avatar_url. clone( ) ) ,
701
+ author_with_avatar(
702
+ "edward-scissorhands" ,
703
+ format!( "{server_url}/test-avatar.png" ) ,
704
+ ) ,
687
705
author( "fiona-apple" ) ,
688
- author( "george-washington" ) ,
689
- author_with_avatar( "helen-keller" , avatar_url. clone( ) ) ,
706
+ author_with_avatar(
707
+ "george-washington" ,
708
+ format!( "{server_url}/test-avatar.webp" ) ,
709
+ ) ,
710
+ author_with_avatar( "helen-keller" , format!( "{server_url}/test-avatar.jpg" ) ) ,
690
711
author( "isaac-newton" ) ,
691
712
author( "jane-doe" ) ,
692
713
]
0 commit comments