From 76e65ddff6190cfb04b70ba2f73b0ca341d29fa1 Mon Sep 17 00:00:00 2001 From: Victor Song Date: Tue, 13 Feb 2024 00:54:17 -0600 Subject: [PATCH] Add test for yanked release logic --- src/web/releases.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/web/releases.rs b/src/web/releases.rs index a3c4282a0..ec46e0ad8 100644 --- a/src/web/releases.rs +++ b/src/web/releases.rs @@ -1248,6 +1248,12 @@ mod tests { .version("0.0.1") .create()?; + env.fake_release() + .name("yet_another_crate") + .version("0.1.0") + .yanked(true) + .create()?; + let _m = crates_io .mock("GET", "/api/v1/crates") .match_query(Matcher::AllOf(vec![ @@ -1262,6 +1268,7 @@ mod tests { { "name": "some_random_crate" }, { "name": "some_other_crate" }, { "name": "and_another_one" }, + { "name": "yet_another_crate" } ], "meta": { "next_page": null, @@ -1282,6 +1289,7 @@ mod tests { // * version used is the highest semver following our own "latest version" logic assert_eq!(links[0], "/some_random_crate/latest/some_random_crate/"); assert_eq!(links[1], "/and_another_one/latest/and_another_one/"); + assert_eq!(links[2], "/yet_another_crate/0.1.0/yet_another_crate/"); Ok(()) }) }