mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-12-13 06:08:20 +00:00
Using assert_length
This commit is contained in:
parent
41cfdca1cf
commit
c8a2652e3f
|
@ -368,7 +368,7 @@ impl InboxCombinedQuery {
|
||||||
inbox_combined::private_message_id.is_not_null().and(
|
inbox_combined::private_message_id.is_not_null().and(
|
||||||
recipient_person
|
recipient_person
|
||||||
.eq(my_person_id)
|
.eq(my_person_id)
|
||||||
.or(person::id.eq(my_person_id)),
|
.or(item_creator.eq(my_person_id)),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -668,7 +668,7 @@ mod tests {
|
||||||
let timmy_inbox = InboxCombinedQuery::default()
|
let timmy_inbox = InboxCombinedQuery::default()
|
||||||
.list(pool, data.timmy.id)
|
.list(pool, data.timmy.id)
|
||||||
.await?;
|
.await?;
|
||||||
assert_eq!(1, timmy_inbox.len());
|
assert_length!(1, timmy_inbox);
|
||||||
|
|
||||||
if let InboxCombinedView::CommentReply(v) = &timmy_inbox[0] {
|
if let InboxCombinedView::CommentReply(v) = &timmy_inbox[0] {
|
||||||
assert_eq!(data.sara_comment.id, v.comment_reply.comment_id);
|
assert_eq!(data.sara_comment.id, v.comment_reply.comment_id);
|
||||||
|
@ -694,7 +694,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
.list(pool, data.timmy.id)
|
.list(pool, data.timmy.id)
|
||||||
.await?;
|
.await?;
|
||||||
assert_eq!(0, timmy_inbox_unread.len());
|
assert_length!(0, timmy_inbox_unread);
|
||||||
|
|
||||||
cleanup(data, pool).await?;
|
cleanup(data, pool).await?;
|
||||||
|
|
||||||
|
@ -732,7 +732,7 @@ mod tests {
|
||||||
let sara_inbox = InboxCombinedQuery::default()
|
let sara_inbox = InboxCombinedQuery::default()
|
||||||
.list(pool, data.sara.id)
|
.list(pool, data.sara.id)
|
||||||
.await?;
|
.await?;
|
||||||
assert_eq!(2, sara_inbox.len());
|
assert_length!(2, sara_inbox);
|
||||||
|
|
||||||
if let InboxCombinedView::PostMention(v) = &sara_inbox[0] {
|
if let InboxCombinedView::PostMention(v) = &sara_inbox[0] {
|
||||||
assert_eq!(data.jessica_post.id, v.person_post_mention.post_id);
|
assert_eq!(data.jessica_post.id, v.person_post_mention.post_id);
|
||||||
|
@ -767,7 +767,7 @@ mod tests {
|
||||||
let sara_inbox_after_block = InboxCombinedQuery::default()
|
let sara_inbox_after_block = InboxCombinedQuery::default()
|
||||||
.list(pool, data.sara.id)
|
.list(pool, data.sara.id)
|
||||||
.await?;
|
.await?;
|
||||||
assert_eq!(1, sara_inbox_after_block.len());
|
assert_length!(1, sara_inbox_after_block);
|
||||||
|
|
||||||
// Make sure the comment mention which timmy made is the hidden one
|
// Make sure the comment mention which timmy made is the hidden one
|
||||||
assert!(matches!(
|
assert!(matches!(
|
||||||
|
@ -785,7 +785,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
.list(pool, data.sara.id)
|
.list(pool, data.sara.id)
|
||||||
.await?;
|
.await?;
|
||||||
assert_eq!(1, sara_inbox_post_mentions_only.len());
|
assert_length!(1, sara_inbox_post_mentions_only);
|
||||||
|
|
||||||
assert!(matches!(
|
assert!(matches!(
|
||||||
sara_inbox_post_mentions_only[0],
|
sara_inbox_post_mentions_only[0],
|
||||||
|
@ -807,7 +807,7 @@ mod tests {
|
||||||
let sara_inbox_after_hide_bots = InboxCombinedQuery::default()
|
let sara_inbox_after_hide_bots = InboxCombinedQuery::default()
|
||||||
.list(pool, data.sara.id)
|
.list(pool, data.sara.id)
|
||||||
.await?;
|
.await?;
|
||||||
assert_eq!(1, sara_inbox_after_hide_bots.len());
|
assert_length!(1, sara_inbox_after_hide_bots);
|
||||||
|
|
||||||
// Make sure the post mention which jessica made is the hidden one
|
// Make sure the post mention which jessica made is the hidden one
|
||||||
assert!(matches!(
|
assert!(matches!(
|
||||||
|
@ -830,7 +830,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
.list(pool, data.sara.id)
|
.list(pool, data.sara.id)
|
||||||
.await?;
|
.await?;
|
||||||
assert_eq!(0, sara_inbox_unread.len());
|
assert_length!(0, sara_inbox_unread);
|
||||||
|
|
||||||
cleanup(data, pool).await?;
|
cleanup(data, pool).await?;
|
||||||
|
|
||||||
|
@ -980,7 +980,7 @@ mod tests {
|
||||||
|
|
||||||
let timmy_unread =
|
let timmy_unread =
|
||||||
InboxCombinedViewInternal::get_unread_count(pool, data.timmy.id, false).await?;
|
InboxCombinedViewInternal::get_unread_count(pool, data.timmy.id, false).await?;
|
||||||
assert_length!(0, timmy_unread);
|
assert_eq!(0, timmy_unread);
|
||||||
|
|
||||||
cleanup(data, pool).await?;
|
cleanup(data, pool).await?;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue