From 2456c077f698d72d411543f33fc1d3da3df14c95 Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Tue, 17 Oct 2023 10:01:31 -0600 Subject: [PATCH] Fix channel test ordering --- crates/collab/src/db/tests/channel_tests.rs | 33 ++++++++++++++------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/crates/collab/src/db/tests/channel_tests.rs b/crates/collab/src/db/tests/channel_tests.rs index ac272726da..40842aff5c 100644 --- a/crates/collab/src/db/tests/channel_tests.rs +++ b/crates/collab/src/db/tests/channel_tests.rs @@ -281,10 +281,12 @@ async fn test_channel_invites(db: &Arc) { assert_eq!(user_3_invites, &[channel_1_1]); - let members = db + let mut members = db .get_channel_participant_details(channel_1_1, user_1) .await .unwrap(); + + members.sort_by_key(|member| member.user_id); assert_eq!( members, &[ @@ -293,16 +295,16 @@ async fn test_channel_invites(db: &Arc) { kind: proto::channel_member::Kind::Member.into(), role: proto::ChannelRole::Admin.into(), }, - proto::ChannelMember { - user_id: user_3.to_proto(), - kind: proto::channel_member::Kind::Invitee.into(), - role: proto::ChannelRole::Admin.into(), - }, proto::ChannelMember { user_id: user_2.to_proto(), kind: proto::channel_member::Kind::Invitee.into(), role: proto::ChannelRole::Member.into(), }, + proto::ChannelMember { + user_id: user_3.to_proto(), + kind: proto::channel_member::Kind::Invitee.into(), + role: proto::ChannelRole::Admin.into(), + }, ] ); @@ -857,10 +859,13 @@ async fn test_user_is_channel_participant(db: &Arc) { .await .unwrap(); - let members = db + let mut members = db .get_channel_participant_details(vim_channel, admin) .await .unwrap(); + + members.sort_by_key(|member| member.user_id); + assert_eq!( members, &[ @@ -912,11 +917,13 @@ async fn test_user_is_channel_participant(db: &Arc) { .await .is_err()); - let members = db + let mut members = db .get_channel_participant_details(vim_channel, admin) .await .unwrap(); + members.sort_by_key(|member| member.user_id); + assert_eq!( members, &[ @@ -951,10 +958,13 @@ async fn test_user_is_channel_participant(db: &Arc) { .unwrap(); // currently people invited to parent channels are not shown here - let members = db + let mut members = db .get_channel_participant_details(vim_channel, admin) .await .unwrap(); + + members.sort_by_key(|member| member.user_id); + assert_eq!( members, &[ @@ -996,10 +1006,13 @@ async fn test_user_is_channel_participant(db: &Arc) { .await .unwrap(); - let members = db + let mut members = db .get_channel_participant_details(vim_channel, admin) .await .unwrap(); + + members.sort_by_key(|member| member.user_id); + assert_eq!( members, &[