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

Function test_load_one_same_cake

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

Source from the content-addressed store, hash-verified

521
522 #[tokio::test]
523 async fn test_load_one_same_cake() {
524 use sea_orm::{entity::prelude::*, tests_cfg::*, DbBackend, LoaderTrait, MockDatabase};
525
526 let db = MockDatabase::new(DbBackend::Postgres)
527 .append_query_results([[cake_model(1), cake_model(2)]])
528 .into_connection();
529
530 let fruits = vec![fruit_model(1, Some(1)), fruit_model(2, Some(1))];
531
532 let cakes = fruits
533 .load_one(cake::Entity::find(), &db)
534 .await
535 .expect("Should return something");
536
537 assert_eq!(cakes, [Some(cake_model(1)), Some(cake_model(1))]);
538 }
539
540 #[tokio::test]
541 async fn test_load_one_empty() {

Callers

nothing calls this directly

Calls 5

into_connectionMethod · 0.80
append_query_resultsMethod · 0.80
load_oneMethod · 0.80
cake_modelFunction · 0.70
newFunction · 0.50

Tested by

no test coverage detected