From 2d13591ec21e6ce04678e2965f08d145cf2d76ae Mon Sep 17 00:00:00 2001 From: cloudhead Date: Thu, 21 Nov 2024 16:05:01 +0100 Subject: [PATCH] radicle: Fix flaky test `counts_by_repo` --- radicle/src/node/notifications/store.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/radicle/src/node/notifications/store.rs b/radicle/src/node/notifications/store.rs index 69ec83f7..6fe29870 100644 --- a/radicle/src/node/notifications/store.rs +++ b/radicle/src/node/notifications/store.rs @@ -443,7 +443,7 @@ mod test { } #[test] - fn test_count_by_repos() { + fn test_counts_by_repo() { let mut db = Store::open(":memory:").unwrap(); let repo1 = arbitrary::gen::(1); let repo2 = arbitrary::gen::(1); @@ -466,15 +466,14 @@ mod test { assert!(db.insert(&repo1, &update2, time).unwrap()); assert!(db.insert(&repo2, &update3, time).unwrap()); - let mut counts = db + let counts = db .counts_by_repo() .unwrap() - .collect::, _>>() + .collect::, _>>() .unwrap(); - counts.sort(); - assert_eq!(counts.first().unwrap(), &(repo1, 2)); - assert_eq!(counts.last().unwrap(), &(repo2, 1)); + assert_eq!(counts.get(&repo1).unwrap(), &2); + assert_eq!(counts.get(&repo2).unwrap(), &1); } #[test]