Skip to content

Commit

Permalink
Make use of find_all in the read test
Browse files Browse the repository at this point in the history
  • Loading branch information
mara-schulke committed Feb 26, 2024
1 parent bcadafb commit 5ee70d9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions atmosphere-core/src/testing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,20 @@ where
"instance was found (find_optional) after deletion"
);

assert!(
E::find_all(pool).await.unwrap().is_empty(),
"there was an instance found in the database before creating"
);

instance.create(pool).await.expect("insertion did not work");

let retrieved = E::find(instance.pk(), pool)
.await
.expect("instance not found after insertion");

assert_eq!(instance, retrieved);

assert_eq!(E::find_all(pool).await.unwrap(), vec![instance.clone()]);
}

/// Tests updating of an entity in the database.
Expand Down

0 comments on commit 5ee70d9

Please sign in to comment.