From a93163dc74523930a11dc235d91932cb7f3ee964 Mon Sep 17 00:00:00 2001 From: Denis Cornehl Date: Mon, 24 Jun 2024 14:46:01 +0200 Subject: [PATCH] fix first test --- src/web/builds.rs | 34 +++++++++++++++------------------- templates/crate/builds.html | 8 ++++++++ 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/web/builds.rs b/src/web/builds.rs index dcbd56a7e..446cfe595 100644 --- a/src/web/builds.rs +++ b/src/web/builds.rs @@ -328,29 +328,25 @@ mod tests { let response = env.frontend().get("/crate/foo/0.1.0/builds").send()?; - // FIXME: temporarily we don't show in-progress releases anywhere, which means we don't - // show releases without builds anywhere. - assert_eq!(response.status(), StatusCode::NOT_FOUND); - - // assert_cache_control(&response, CachePolicy::NoCaching, &env.config()); - // let page = kuchikiki::parse_html().one(response.text()?); + assert_cache_control(&response, CachePolicy::NoCaching, &env.config()); + let page = kuchikiki::parse_html().one(response.text()?); - // let rows: Vec<_> = page - // .select("ul > li a.release") - // .unwrap() - // .map(|row| row.text_contents()) - // .collect(); + let rows: Vec<_> = page + .select("ul > li a.release") + .unwrap() + .map(|row| row.text_contents()) + .collect(); - // assert!(rows.is_empty()); + assert!(rows.is_empty()); - // let warning = page - // .select_first(".warning") - // .expect("missing warning element") - // .text_contents(); + let warning = page + .select_first(".warning") + .expect("missing warning element") + .text_contents(); - // assert!(warning.contains("has not built")); - // assert!(warning.contains("queued")); - // assert!(warning.contains("open an issue")); + assert!(warning.contains("has not built")); + assert!(warning.contains("queued")); + assert!(warning.contains("open an issue")); Ok(()) }); diff --git a/templates/crate/builds.html b/templates/crate/builds.html index 505f70b5a..d5ea34375 100644 --- a/templates/crate/builds.html +++ b/templates/crate/builds.html @@ -85,6 +85,14 @@ {%- endfor -%} + {%- else -%} +
+ docs.rs has not built {{ metadata.name }}-{{ metadata.version }} +
+ It may still be queued or in-progress. +
+ If you believe this is docs.rs' fault, open an issue. +
{%- endif -%}