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

Function test_edit_board

tests/service.rs:52–100  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

50
51 #[tokio::test]
52 async fn test_edit_board() {
53 run_test(async {
54 let (context_manager, _recv) = ContextManager::new().await;
55
56 let id: String;
57
58 '_preparation_block: {
59 let mut uow =
60 UnitOfWork::<Repository<BoardAggregate>>::new(context_manager.clone())
61 .await
62 .unwrap();
63
64 let mut board_aggregate = board_create_helper(BoardState::Published);
65 id = uow.repository().add(&mut board_aggregate).await.unwrap();
66 assert_eq!(board_aggregate.board.id.to_string(), id);
67 uow.commit().await.unwrap();
68 }
69
70 '_test_block: {
71 let cmd = EditBoard {
72 id: Uuid::from_str(&id).unwrap(),
73 title: None,
74 content: Some("Changed to this".to_string()),
75 state: None,
76 };
77
78 let id = cmd.id.clone().to_string();
79
80 match ServiceHandler::edit_board(cmd, context_manager.clone()).await {
81 Err(err) => '_fail_case: {
82 panic!("Service Handling Failed! {}", err)
83 }
84 Ok(_res) => {
85 let mut uow =
86 UnitOfWork::<Repository<BoardAggregate>>::new(context_manager.clone())
87 .await
88 .unwrap();
89 if let Ok(board_aggregate) = uow.repository().get(&id).await {
90 assert_eq!(
91 board_aggregate.board.content,
92 "Changed to this".to_string()
93 );
94 };
95 }
96 }
97 }
98 })
99 .await;
100 }
101
102 #[tokio::test]
103 async fn test_add_comment() {

Callers

nothing calls this directly

Calls 7

board_create_helperFunction · 0.85
edit_boardFunction · 0.85
repositoryMethod · 0.80
run_testFunction · 0.70
addMethod · 0.45
commitMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected