()
| 128 | |
| 129 | #[tokio::test] |
| 130 | async fn test_update_board() { |
| 131 | run_test(async { |
| 132 | let (context_manager, _) = ContextManager::new().await; |
| 133 | let executor = context_manager.read().await.executor(); |
| 134 | let mut board_repo = board_repository_helper(executor.clone()); |
| 135 | let id: String; |
| 136 | |
| 137 | let existing_content: String; |
| 138 | |
| 139 | '_transaction_block: { |
| 140 | executor.write().await.begin().await.unwrap(); |
| 141 | |
| 142 | let mut board_aggregate = board_create_helper(BoardState::Unpublished); |
| 143 | existing_content = board_aggregate.board.content.clone(); |
| 144 | |
| 145 | id = board_repo.add(&mut board_aggregate).await.unwrap(); |
| 146 | |
| 147 | executor.write().await.commit().await.unwrap(); |
| 148 | } |
| 149 | |
| 150 | '_transaction_block2: { |
| 151 | executor.write().await.begin().await.unwrap(); |
| 152 | |
| 153 | let mut initial_board_aggregate = board_repo.get(&id).await.unwrap(); |
| 154 | let initial_board = &mut initial_board_aggregate.board; |
| 155 | |
| 156 | '_test_block: { |
| 157 | assert_eq!(initial_board.version, 0); |
| 158 | } |
| 159 | let new_author = Uuid::new_v4(); |
| 160 | initial_board.author = new_author; |
| 161 | initial_board.content = "Something else".to_string(); |
| 162 | board_repo |
| 163 | .update(&mut initial_board_aggregate) |
| 164 | .await |
| 165 | .unwrap(); |
| 166 | |
| 167 | executor.write().await.commit().await.unwrap(); |
| 168 | |
| 169 | '_test_block: { |
| 170 | let board_aggregate = board_repo.get(&id).await.unwrap(); |
| 171 | let updated_board = board_aggregate.board; |
| 172 | |
| 173 | assert_eq!(updated_board.author, new_author); |
| 174 | assert_ne!(updated_board.content, existing_content); |
| 175 | assert_eq!(updated_board.version, 1); |
| 176 | } |
| 177 | } |
| 178 | }) |
| 179 | .await; |
| 180 | } |
| 181 | |
| 182 | #[tokio::test] |
| 183 | async fn test_create_comment() { |
nothing calls this directly
no test coverage detected