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

Function test_load_many

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

Source from the content-addressed store, hash-verified

557
558 #[tokio::test]
559 async fn test_load_many() {
560 use sea_orm::{entity::prelude::*, tests_cfg::*, DbBackend, LoaderTrait, MockDatabase};
561
562 let db = MockDatabase::new(DbBackend::Postgres)
563 .append_query_results([[fruit_model(1, Some(1))]])
564 .into_connection();
565
566 let cakes = vec![cake_model(1), cake_model(2)];
567
568 let fruits = cakes
569 .load_many(fruit::Entity::find(), &db)
570 .await
571 .expect("Should return something");
572
573 assert_eq!(fruits, [vec![fruit_model(1, Some(1))], vec![]]);
574 }
575
576 #[tokio::test]
577 async fn test_load_many_same_fruit() {

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