()
| 629 | |
| 630 | #[tokio::test] |
| 631 | async fn commands_handler_stops_after_processing_queued_cmd() { |
| 632 | let mut db = MockDB::new(); |
| 633 | db.expect_cancel_vote() |
| 634 | .with(eq(REPOFN), eq(ISSUE_NUM)) |
| 635 | .times(1) |
| 636 | .returning(|_, _| Box::pin(future::ready(Err(format_err!(ERROR))))); |
| 637 | let mut gh = MockGH::new(); |
| 638 | gh.expect_user_is_collaborator() |
| 639 | .with(eq(INST_ID), eq(ORG), eq(REPO), eq(USER)) |
| 640 | .times(1) |
| 641 | .returning(|_, _, _, _| Box::pin(future::ready(Ok(true)))); |
| 642 | |
| 643 | let (cmds_tx, cmds_rx) = async_channel::unbounded(); |
| 644 | let cancel_token = CancellationToken::new(); |
| 645 | let event = setup_test_issue_event(); |
| 646 | let cmd = Command::CancelVote(CancelVoteInput::new(&Event::Issue(event))); |
| 647 | cmds_tx.send(cmd).await.unwrap(); |
| 648 | let cmds_handler = CommandsHandler::new(Arc::new(db), Arc::new(gh), cmds_rx.clone()); |
| 649 | let cmds_handler_handle = cmds_handler.run(cancel_token.clone()); |
| 650 | cancel_token.cancel(); |
| 651 | |
| 652 | assert!(cmds_handler_handle.await.is_ok()); |
| 653 | assert!(cmds_rx.is_empty()); |
| 654 | } |
| 655 | |
| 656 | #[tokio::test] |
| 657 | async fn votes_closer_stops_when_requested_none_closed() { |
nothing calls this directly
no test coverage detected