@@ -713,11 +713,18 @@ async fn index_include_yanked() {
713713 assert_eq ! ( json. crates[ 1 ] . name, "newest_yanked" ) ;
714714 assert_eq ! ( json. crates[ 2 ] . name, "oldest_yanked" ) ;
715715 assert_eq ! ( json. crates[ 3 ] . name, "unyanked" ) ;
716+
716717 assert_eq ! (
717718 default_versions_iter( & json. crates)
718- . flatten( )
719+ . flat_map( |s| s. as_deref( ) )
720+ . zip( yanked_iter( & json. crates) . flatten( ) . cloned( ) )
719721 . collect:: <Vec <_>>( ) ,
720- [ "2.0.0" , "1.0.0" , "2.0.0" , "2.0.0" , ]
722+ [
723+ ( "2.0.0" , true ) ,
724+ ( "1.0.0" , false ) ,
725+ ( "2.0.0" , false ) ,
726+ ( "2.0.0" , false ) ,
727+ ]
721728 ) ;
722729 }
723730
@@ -729,9 +736,10 @@ async fn index_include_yanked() {
729736 assert_eq ! ( json. crates[ 2 ] . name, "unyanked" ) ;
730737 assert_eq ! (
731738 default_versions_iter( & json. crates)
732- . flatten( )
739+ . flat_map( |s| s. as_deref( ) )
740+ . zip( yanked_iter( & json. crates) . flatten( ) . cloned( ) )
733741 . collect:: <Vec <_>>( ) ,
734- [ "1.0.0" , "2.0.0" , "2.0.0" , ]
742+ [ ( "1.0.0" , false ) , ( "2.0.0" , false ) , ( "2.0.0" , false ) , ]
735743 ) ;
736744 }
737745}
@@ -751,6 +759,7 @@ async fn yanked_versions_are_not_considered_for_max_version() {
751759 for json in search_both ( & anon, "q=foo" ) . await {
752760 assert_eq ! ( json. meta. total, 1 ) ;
753761 assert_eq ! ( json. crates[ 0 ] . default_version, Some ( "1.0.0" . into( ) ) ) ;
762+ assert_eq ! ( json. crates[ 0 ] . yanked, Some ( false ) ) ;
754763 assert_eq ! ( json. crates[ 0 ] . max_version, "1.0.0" ) ;
755764 }
756765}
@@ -773,6 +782,7 @@ async fn max_stable_version() {
773782 for json in search_both ( & anon, "q=foo" ) . await {
774783 assert_eq ! ( json. meta. total, 1 ) ;
775784 assert_eq ! ( json. crates[ 0 ] . default_version, Some ( "1.0.0" . into( ) ) ) ;
785+ assert_eq ! ( json. crates[ 0 ] . yanked, Some ( false ) ) ;
776786 assert_eq ! ( json. crates[ 0 ] . max_stable_version, Some ( "1.0.0" . to_string( ) ) ) ;
777787 }
778788}
@@ -1149,6 +1159,7 @@ async fn page_with_seek<U: RequestHelper>(
11491159 url = Some ( new_url. to_owned ( ) ) ;
11501160 assert_ne ! ( resp. meta. total, 0 ) ;
11511161 assert ! ( default_versions_iter( & resp. crates) . all( Option :: is_some) ) ;
1162+ assert ! ( yanked_iter( & resp. crates) . all( Option :: is_some) ) ;
11521163 } else {
11531164 assert_that ! ( resp. crates, empty( ) ) ;
11541165 assert_eq ! ( resp. meta. total, 0 ) ;
@@ -1163,3 +1174,7 @@ fn default_versions_iter(
11631174) -> impl Iterator < Item = & Option < String > > {
11641175 crates. iter ( ) . map ( |c| & c. default_version )
11651176}
1177+
1178+ fn yanked_iter ( crates : & [ crate :: tests:: EncodableCrate ] ) -> impl Iterator < Item = & Option < bool > > {
1179+ crates. iter ( ) . map ( |c| & c. yanked )
1180+ }
0 commit comments