| 615 | |
| 616 | #[tokio::test] |
| 617 | async fn commands_handler_stops_when_requested() { |
| 618 | let db = MockDB::new(); |
| 619 | let gh = MockGH::new(); |
| 620 | |
| 621 | let (_, cmds_rx) = async_channel::unbounded(); |
| 622 | let cancel_token = CancellationToken::new(); |
| 623 | let cmds_handler = CommandsHandler::new(Arc::new(db), Arc::new(gh), cmds_rx); |
| 624 | let cmds_handler_handle = cmds_handler.run(cancel_token.clone()); |
| 625 | cancel_token.cancel(); |
| 626 | |
| 627 | assert!(cmds_handler_handle.await.is_ok()); |
| 628 | } |
| 629 | |
| 630 | #[tokio::test] |
| 631 | async fn commands_handler_stops_after_processing_queued_cmd() { |