@@ -1077,7 +1077,7 @@ mod tests {
1077
1077
}
1078
1078
1079
1079
#[ test]
1080
- fn search_result_can_retrive_sort_by_from_pagination ( ) {
1080
+ fn search_result_can_retrieve_sort_by_from_pagination ( ) {
1081
1081
wrapper ( |env| {
1082
1082
let mut crates_io = mockito:: Server :: new ( ) ;
1083
1083
env. override_config ( |config| {
@@ -1854,6 +1854,67 @@ mod tests {
1854
1854
} ) ;
1855
1855
}
1856
1856
1857
+ #[ test]
1858
+ fn test_releases_rebuild_queue_empty ( ) {
1859
+ wrapper ( |env| {
1860
+ let web = env. frontend ( ) ;
1861
+
1862
+ let empty = kuchikiki:: parse_html ( ) . one ( web. get ( "/releases/queue" ) . send ( ) ?. text ( ) ?) ;
1863
+
1864
+ assert ! ( empty
1865
+ . select( ".about > p" )
1866
+ . expect( "missing heading" )
1867
+ . any( |el| el. text_contents( ) . contains( "We continuously rebuild" ) ) ) ;
1868
+
1869
+ assert ! ( empty
1870
+ . select( ".about > p" )
1871
+ . expect( "missing heading" )
1872
+ . any( |el| el. text_contents( ) . contains( "crates in the rebuild queue" ) ) ) ;
1873
+
1874
+ Ok ( ( ) )
1875
+ } ) ;
1876
+ }
1877
+
1878
+ #[ test]
1879
+ fn test_releases_rebuild_queue_with_crates ( ) {
1880
+ wrapper ( |env| {
1881
+ let web = env. frontend ( ) ;
1882
+ let queue = env. build_queue ( ) ;
1883
+ queue. add_crate ( "foo" , "1.0.0" , REBUILD_PRIORITY , None ) ?;
1884
+ queue. add_crate ( "bar" , "0.1.0" , REBUILD_PRIORITY + 1 , None ) ?;
1885
+ queue. add_crate ( "baz" , "0.0.1" , REBUILD_PRIORITY - 1 , None ) ?;
1886
+
1887
+ let full = kuchikiki:: parse_html ( ) . one ( web. get ( "/releases/queue" ) . send ( ) ?. text ( ) ?) ;
1888
+ let items = full
1889
+ . select ( ".rebuild-queue-list > li" )
1890
+ . expect ( "missing list items" )
1891
+ . collect :: < Vec < _ > > ( ) ;
1892
+
1893
+ // empty because expand_rebuild_queue is not set
1894
+ assert_eq ! ( items. len( ) , 0 ) ;
1895
+ assert ! ( full
1896
+ . select( ".about > p" )
1897
+ . expect( "missing heading" )
1898
+ . any( |el| el
1899
+ . text_contents( )
1900
+ . contains( "There are currently 2 crates in the rebuild queue" ) ) ) ;
1901
+
1902
+ let full =
1903
+ kuchikiki:: parse_html ( ) . one ( web. get ( "/releases/queue?expand=1" ) . send ( ) ?. text ( ) ?) ;
1904
+ let items = full
1905
+ . select ( ".rebuild-queue-list > li" )
1906
+ . expect ( "missing list items" )
1907
+ . collect :: < Vec < _ > > ( ) ;
1908
+
1909
+ assert_eq ! ( items. len( ) , 2 ) ;
1910
+ assert ! ( items. iter( ) . any( |li| li. text_contents( ) . contains( "foo" ) ) ) ;
1911
+ assert ! ( items. iter( ) . any( |li| li. text_contents( ) . contains( "bar" ) ) ) ;
1912
+ assert ! ( !items. iter( ) . any( |li| li. text_contents( ) . contains( "baz" ) ) ) ;
1913
+
1914
+ Ok ( ( ) )
1915
+ } ) ;
1916
+ }
1917
+
1857
1918
#[ test]
1858
1919
fn home_page_links ( ) {
1859
1920
wrapper ( |env| {
0 commit comments