Add test assertion where user is not admin of channel

Max Brunsfeld created

Change summary

crates/collab/src/db/tests.rs | 32 +++++++++++++++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)

Detailed changes

crates/collab/src/db/tests.rs 🔗

@@ -952,7 +952,6 @@ test_both_dbs!(test_channels_postgres, test_channels_sqlite, db, {
         .unwrap();
 
     let (channels, _) = db.get_channels_for_user(a_id).await.unwrap();
-
     assert_eq!(
         channels,
         vec![
@@ -1001,6 +1000,37 @@ test_both_dbs!(test_channels_postgres, test_channels_sqlite, db, {
         ]
     );
 
+    let (channels, _) = db.get_channels_for_user(b_id).await.unwrap();
+    assert_eq!(
+        channels,
+        vec![
+            Channel {
+                id: zed_id,
+                name: "zed".to_string(),
+                parent_id: None,
+                user_is_admin: true,
+            },
+            Channel {
+                id: crdb_id,
+                name: "crdb".to_string(),
+                parent_id: Some(zed_id),
+                user_is_admin: false,
+            },
+            Channel {
+                id: livestreaming_id,
+                name: "livestreaming".to_string(),
+                parent_id: Some(zed_id),
+                user_is_admin: false,
+            },
+            Channel {
+                id: replace_id,
+                name: "replace".to_string(),
+                parent_id: Some(zed_id),
+                user_is_admin: false,
+            },
+        ]
+    );
+
     // Remove a single channel
     db.remove_channel(crdb_id, a_id).await.unwrap();
     assert!(db.get_channel(crdb_id, a_id).await.unwrap().is_none());