From 1a61f0927105489a980094d2f8c3c7ff24326878 Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Fri, 24 Sep 2021 11:00:02 +0800 Subject: [PATCH] More test cases --- tests/relational_tests.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/relational_tests.rs b/tests/relational_tests.rs index caef9c3c5..e3138bb3b 100644 --- a/tests/relational_tests.rs +++ b/tests/relational_tests.rs @@ -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; Ok(())