From bfdede4cb51f75e0d5dd13ebb0930b4f22c69088 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Sun, 7 Jul 2024 13:23:27 -0400 Subject: [PATCH] Add unit test for is_higher_mod_or_admin_check --- crates/db_schema/src/impls/community.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/crates/db_schema/src/impls/community.rs b/crates/db_schema/src/impls/community.rs index d704ef574..33c062cb4 100644 --- a/crates/db_schema/src/impls/community.rs +++ b/crates/db_schema/src/impls/community.rs @@ -447,6 +447,7 @@ mod tests { CommunityUpdateForm, }, instance::Instance, + local_user::LocalUser, person::{Person, PersonInsertForm}, }, traits::{Bannable, Crud, Followable, Joinable}, @@ -557,6 +558,16 @@ mod tests { .await; assert!(bobby_higher_check.is_ok()); + // Also check the other is_higher_mod_or_admin function just in case + let bobby_higher_check_2 = LocalUser::is_higher_mod_or_admin_check( + pool, + inserted_community.id, + inserted_bobby.id, + &moderator_person_ids, + ) + .await; + assert!(bobby_higher_check_2.is_ok()); + // This should throw an error, since artemis was added later let artemis_higher_check = CommunityModerator::is_higher_mod_check( pool,