Skip to content

Commit 66eee92

Browse files
Add missing test for docs.rs crate page
1 parent 9d130ea commit 66eee92

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/web/crate_details.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -505,11 +505,7 @@ pub(crate) async fn get_all_platforms(
505505
Extension(pool): Extension<Pool>,
506506
uri: Uri,
507507
) -> AxumResult<AxumResponse> {
508-
let is_crate_root = params
509-
.path
510-
.as_ref()
511-
.map(|path| path == "index.html")
512-
.unwrap_or(true);
508+
let is_crate_root = uri.path().starts_with("/crate/");
513509
let req_path: String = params.path.unwrap_or_default();
514510
let req_path: Vec<&str> = req_path.split('/').collect();
515511

@@ -1289,6 +1285,17 @@ mod tests {
12891285
.add_target("x86_64-pc-windows-msvc")
12901286
.create()?;
12911287

1288+
let response = env.frontend().get("/crate/dummy/0.4.0").send()?;
1289+
assert!(response.status().is_success());
1290+
check_links(response.text()?, false, false);
1291+
// Same test with AJAX endpoint.
1292+
let response = env
1293+
.frontend()
1294+
.get("/-/menus/platforms/crate/dummy/0.4.0")
1295+
.send()?;
1296+
assert!(response.status().is_success());
1297+
check_links(response.text()?, true, false);
1298+
12921299
let response = env.frontend().get("/dummy/latest/dummy").send()?;
12931300
assert!(response.status().is_success());
12941301
check_links(response.text()?, false, true);
@@ -1298,7 +1305,7 @@ mod tests {
12981305
.get("/-/menus/platforms/dummy/latest/dummy")
12991306
.send()?;
13001307
assert!(response.status().is_success());
1301-
check_links(response.text()?, true, false);
1308+
check_links(response.text()?, true, true);
13021309

13031310
let response = env
13041311
.frontend()

0 commit comments

Comments
 (0)