MCPcopy Create free account
hub / github.com/Migorithm/rustiful-backend / test_transaction_commit

Function test_transaction_commit

tests/database.rs:30–53  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

28
29 #[tokio::test]
30 async fn test_transaction_commit() {
31 run_test(async {
32 let pool = connection_pool().await;
33 let executor = Arc::new(RwLock::new(Executor::new(pool)));
34 // let mut uow = UnitOfWork::<Repository<BoardAggregate>, BoardAggregate>::new(
35 // connection.read().await.executor(),
36 // );
37
38 executor.write().await.begin().await.unwrap();
39
40 let mut board_repo: Repository<BoardAggregate> =
41 board_repository_helper(executor.clone());
42
43 let mut board_aggregate = board_create_helper(BoardState::Unpublished);
44 let id = board_repo.add(&mut board_aggregate).await.unwrap();
45
46 executor.write().await.commit().await.unwrap();
47
48 //TODO Should exist
49
50 let _board_aggregate = board_repo.get(&id).await.unwrap();
51 })
52 .await;
53 }
54
55 #[tokio::test]
56 async fn test_transaction_rollback() {

Callers

nothing calls this directly

Calls 8

connection_poolFunction · 0.85
board_repository_helperFunction · 0.85
board_create_helperFunction · 0.85
run_testFunction · 0.70
beginMethod · 0.45
addMethod · 0.45
commitMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected