pub fn assert_event_journal(&mut self, expected: &[&str]) {
        let events = self.runtime().block_on(async {
            let mut events = vec![];

            let drain_future = async {
                loop {
                    match self.work_journal_rx.recv().await {
                        Some(event) => {
                            events.push(event);

                            // Break as soon as we collect the desired number of events.
                            if events.len() >= expected.len() {
                                break;
                            }
                        }
                        None => break,
                    }
                }
            };

            // Drain the expected number of events from the channel, or time out and give up.
            tokio::select! {
                _ = tokio::time::sleep(STANDARD_TIMEOUT) => panic!(
                    "timeout ({:?}) expired waiting for events. expected {:?} but got {:?}",
                    STANDARD_TIMEOUT,
                    expected,
                    events
                ),
                _ = drain_future => {},
            }

            events
        });

        assert_eq!(
            events,
            expected
                .into_iter()
                .map(|s| s.to_string())
                .collect::<Vec<_>>()
        );
    }
/// Assert that the `BeaconProcessor` event journal is as `expected`.
///
/// ## Note
///
/// We won't attempt to listen for any more than `expected.len()` events. As such, it makes sense
/// to use the `NOTHING_TO_DO` event to ensure that execution has completed.
Assert that the `BeaconProcessor` event journal is as `expected`.
Assert that the ` BeaconProcessor ` event journal is as ` expected ` .
pub fn assert_event_journal(&mut self, expected: &[&str]) {
        let events = self.runtime().block_on(async {
            let mut events = vec![];
            let drain_future = async {
                loop {
                    match self.work_journal_rx.recv().await {
                        Some(event) => {
                            events.push(event);
                            // Break as soon as we collect the desired number of events.
                            if events.len() >= expected.len() {
                                break;
                            }
                        }
                        None => break,
                    }
                }
            };
            // Drain the expected number of events from the channel, or time out and give up.
            tokio::select! {
                _ = tokio::time::sleep(STANDARD_TIMEOUT) => panic!(
                    "timeout ({:?}) expired waiting for events. expected {:?} but got {:?}",
                    STANDARD_TIMEOUT,
                    expected,
                    events
                ),
                _ = drain_future => {},
            }
            events
        });
        assert_eq!(
            events,
            expected
                .into_iter()
                .map(|s| s.to_string())
                .collect::<Vec<_>>()
        );
    }
pub fn assert_event_journal ( & mut self , expected : & [ & str ] ) { let events = self . runtime ( ) . block_on ( async { let mut events = vec ! [ ] ; let drain_future = async { loop { match self . work_journal_rx . recv ( ) . await { Some ( event ) => { events . push ( event ) ; // Break as soon as we collect the desired number of events. if events . len ( ) >= expected . len ( ) { break ; } } None => break , } } } ; // Drain the expected number of events from the channel, or time out and give up. tokio :: select ! { tokio time sleep ( STANDARD_TIMEOUT ) panic ( " " STANDARD_TIMEOUT expected events ) drain_future { } } events } ) ; assert_eq ! ( events expected into_iter ( ) map ( s s to_string ( ) ) collect Vec ( ) ) ; }
Assert that the `BeaconProcessor` event journal is as `expected`.
Assert that the ` BeaconProcessor ` event journal is as ` expected ` .
&mut self
expected
&[&str]
note
We won't attempt to listen for any more than `expected.len()` events. As such, it makes sense
to use the `NOTHING_TO_DO` event to ensure that execution has completed.
We won ' t attempt to listen for any more than ` expected . len () ` events . As such it makes sense to use the ` NOTHING_TO_DO ` event to ensure that execution has completed .