MCPcopy Create free account
hub / github.com/SeaQL/sea-orm / test_load_many_same_fruit

Function test_load_many_same_fruit

src/query/loader.rs:577–598  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

575
576 #[tokio::test]
577 async fn test_load_many_same_fruit() {
578 use sea_orm::{entity::prelude::*, tests_cfg::*, DbBackend, LoaderTrait, MockDatabase};
579
580 let db = MockDatabase::new(DbBackend::Postgres)
581 .append_query_results([[fruit_model(1, Some(1)), fruit_model(2, Some(1))]])
582 .into_connection();
583
584 let cakes = vec![cake_model(1), cake_model(2)];
585
586 let fruits = cakes
587 .load_many(fruit::Entity::find(), &db)
588 .await
589 .expect("Should return something");
590
591 assert_eq!(
592 fruits,
593 [
594 vec![fruit_model(1, Some(1)), fruit_model(2, Some(1))],
595 vec![]
596 ]
597 );
598 }
599
600 #[tokio::test]
601 async fn test_load_many_empty() {

Callers

nothing calls this directly

Calls 5

into_connectionMethod · 0.80
append_query_resultsMethod · 0.80
load_manyMethod · 0.80
fruit_modelFunction · 0.70
newFunction · 0.50

Tested by

no test coverage detected