From b20e900b6753c861a30ba27b91dd254113592218 Mon Sep 17 00:00:00 2001 From: Dylan Anthony Date: Wed, 19 Jun 2024 12:42:33 -0600 Subject: [PATCH] test: Fix indeterministic test --- tests/change_set.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/change_set.rs b/tests/change_set.rs index 110ef68..dbda7ac 100644 --- a/tests/change_set.rs +++ b/tests/change_set.rs @@ -31,9 +31,11 @@ fn load_changeset() { .unwrap(); let changeset = ChangeSet::from_directory(&dir).unwrap(); - let mut releases: Vec = changeset.into(); - let second_release = releases.pop().unwrap(); - let first_release = releases.pop().unwrap(); + let releases: Vec = changeset.into(); + let first_release = releases + .iter() + .find(|release| release.package_name == first_package) + .unwrap(); assert_eq!(first_release.package_name, first_package); assert_eq!(first_release.change_type().unwrap(), &first_change_type); assert_eq!( @@ -44,6 +46,10 @@ fn load_changeset() { summary: first_change_summary.into() },] ); + let second_release = releases + .iter() + .find(|release| release.package_name == second_package) + .unwrap(); assert_eq!(second_release.package_name, second_package); assert_eq!(second_release.change_type().unwrap(), &second_change_type); // Order of reading files is probably not guaranteed