Skip to content

Commit

Permalink
fix first test
Browse files Browse the repository at this point in the history
  • Loading branch information
syphar committed Jun 24, 2024
1 parent 2db23d5 commit a93163d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 19 deletions.
34 changes: 15 additions & 19 deletions src/web/builds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
});
Expand Down
8 changes: 8 additions & 0 deletions templates/crate/builds.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@
</li>
{%- endfor -%}
</ul>
{%- else -%}
<div class="warning">
docs.rs has not built {{ metadata.name }}-{{ metadata.version }}
<br>
It may still be <a href="/releases/queue">queued</a> or in-progress.
<br>
If you believe this is docs.rs' fault, <a href="https://github.com/rust-lang/docs.rs/issues/new/choose">open an issue</a>.
</div>
{%- endif -%}

<div class="about">
Expand Down

0 comments on commit a93163d

Please sign in to comment.