Skip to content

Commit

Permalink
Forgot to format
Browse files Browse the repository at this point in the history
  • Loading branch information
ninanator committed Jun 18, 2023
1 parent 9c2499d commit 9181f8f
Showing 1 changed file with 24 additions and 25 deletions.
49 changes: 24 additions & 25 deletions crates/db_views/src/comment_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,10 @@ mod tests {
// Languages
let english_id = Language::read_id_from_code(pool, Some("en")).await.unwrap();
let finnish_id = Language::read_id_from_code(pool, Some("fi")).await.unwrap();
let polish_id = Language::read_id_from_code(pool, Some("pl")).await.unwrap().unwrap();
let polish_id = Language::read_id_from_code(pool, Some("pl"))
.await
.unwrap()
.unwrap();

// Create instance
let inserted_instance = Instance::read_or_create(pool, "my_domain.tld".to_string())
Expand All @@ -451,23 +454,23 @@ mod tests {

// Create person Timmy
let new_person = PersonInsertForm::builder()
.name("timmy".into())
.public_key("pubkey".to_string())
.instance_id(inserted_instance.id)
.build();
.name("timmy".into())
.public_key("pubkey".to_string())
.instance_id(inserted_instance.id)
.build();
let inserted_person = Person::create(pool, &new_person).await.unwrap();
let local_user_form = LocalUserInsertForm::builder()
.person_id(inserted_person.id)
.password_encrypted(String::new())
.build();
.person_id(inserted_person.id)
.password_encrypted(String::new())
.build();
let inserted_local_user = LocalUser::create(pool, &local_user_form).await.unwrap();

// Create person Sara
let new_person_2 = PersonInsertForm::builder()
.name("sara".into())
.public_key("pubkey".to_string())
.instance_id(inserted_instance.id)
.build();
.name("sara".into())
.public_key("pubkey".to_string())
.instance_id(inserted_instance.id)
.build();
let inserted_person_2 = Person::create(pool, &new_person_2).await.unwrap();

// Create a comment tree with this hierarchy between Timmy and Sara
Expand All @@ -488,11 +491,11 @@ mod tests {
let inserted_post = Post::create(pool, &new_post).await.unwrap();

let comment_form_0 = CommentInsertForm::builder()
.content("Comment 0".into())
.creator_id(inserted_person.id)
.post_id(inserted_post.id)
.language_id(english_id)
.build();
.content("Comment 0".into())
.creator_id(inserted_person.id)
.post_id(inserted_post.id)
.language_id(english_id)
.build();
let inserted_comment_0 = Comment::create(pool, &comment_form_0, None).await.unwrap();

// Sara adds comment 1 to the post
Expand Down Expand Up @@ -611,11 +614,9 @@ mod tests {
.unwrap();

assert_eq!(
expected_comment_view_no_person,
read_comment_views_no_person[0],
expected_comment_view_no_person, read_comment_views_no_person[0],
"Expected comment 0, got comment: {}. All comments: {:?}",
read_comment_views_no_person[0].comment.content,
read_comment_views_no_person,
read_comment_views_no_person[0].comment.content, read_comment_views_no_person,
);

let read_comment_views_with_person = CommentQuery::builder()
Expand All @@ -629,11 +630,9 @@ mod tests {
.unwrap();

assert_eq!(
expected_comment_view_with_person,
read_comment_views_with_person[0],
expected_comment_view_with_person, read_comment_views_with_person[0],
"Expected comment 0, got comment: {}. All comments: {:?}",
read_comment_views_no_person[0].comment.content,
read_comment_views_no_person,
read_comment_views_no_person[0].comment.content, read_comment_views_no_person,
);

assert_eq!(
Expand Down

0 comments on commit 9181f8f

Please sign in to comment.