From 7ba1d989159bcce107b03f2faa4f3e055156810f Mon Sep 17 00:00:00 2001 From: Nutomic Date: Tue, 21 Nov 2023 16:08:19 +0100 Subject: [PATCH] Prevent random test failure (#4184) --- crates/db_views/Cargo.toml | 1 + crates/db_views/src/comment_view.rs | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/crates/db_views/Cargo.toml b/crates/db_views/Cargo.toml index 5c57888b7..847b74392 100644 --- a/crates/db_views/Cargo.toml +++ b/crates/db_views/Cargo.toml @@ -23,6 +23,7 @@ full = [ "tracing", "ts-rs", "actix-web", + "lemmy_db_schema/full", ] [dependencies] diff --git a/crates/db_views/src/comment_view.rs b/crates/db_views/src/comment_view.rs index ad01ff309..16f524190 100644 --- a/crates/db_views/src/comment_view.rs +++ b/crates/db_views/src/comment_view.rs @@ -811,9 +811,17 @@ mod tests { CommunityModerator::join(pool, &form).await.unwrap(); // Make sure that they come back as a mod in the list - let comments = CommentQuery::default().list(pool).await.unwrap(); + let comments = CommentQuery { + sort: Some(CommentSortType::New), + ..Default::default() + } + .list(pool) + .await + .unwrap(); - assert!(comments[1].creator_is_moderator); + assert!(!comments[0].creator_is_moderator); + assert!(!comments[1].creator_is_moderator); + assert!(comments[4].creator_is_moderator); cleanup(data, pool).await; }