More test cases

This commit is contained in:
Billy Chan 2021-09-24 11:00:02 +08:00
parent ee504e7d9f
commit 9c8f5aa93d
No known key found for this signature in database
GPG Key ID: A2D690CAC7DF3CC7

View File

@ -708,6 +708,26 @@ pub async fn linked() -> Result<(), DbErr> {
] ]
); );
let baker_bob = Baker::find()
.filter(baker::Column::Id.eq(1))
.one(&ctx.db)
.await?
.unwrap();
let baker_bob_customers = baker_bob
.find_linked(baker::BakedForCustomer)
.all(&ctx.db)
.await?;
assert_eq!(
baker_bob_customers,
vec![customer::Model {
id: 2,
name: "Kara".to_owned(),
notes: Some("Loves all cakes".to_owned()),
}]
);
ctx.delete().await; ctx.delete().await;
Ok(()) Ok(())