Skip to content

Commit

Permalink
Add test for yanked release logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyrubias committed Feb 13, 2024
1 parent d9d5f54 commit 76e65dd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/web/releases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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![
Expand All @@ -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,
Expand All @@ -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(())
})
}
Expand Down

0 comments on commit 76e65dd

Please sign in to comment.