diff --git a/src/parse.rs b/src/parse.rs index 7a026c2b..8a2a1cc3 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -504,6 +504,28 @@ mod tests { assert_eq!(fetches[0].uid, Some(74)); } + #[test] + fn parse_fetches_w_dovecot_info() { + // Dovecot will sometimes send informational unsolicited + // OK messages while performing long operations. + // * OK Searched 91% of the mailbox, ETA 0:01 + let lines = b"\ + * OK Searched 91% of the mailbox, ETA 0:01\r\n\ + * 37 FETCH (UID 74)\r\n"; + let (mut send, recv) = mpsc::channel(); + let fetches = parse_fetches(lines.to_vec(), &mut send).unwrap(); + assert_eq!( + recv.try_recv(), + Ok(UnsolicitedResponse::Ok { + code: None, + information: Some(String::from("Searched 91% of the mailbox, ETA 0:01")), + }) + ); + assert_eq!(fetches.len(), 1); + assert_eq!(fetches[0].message, 37); + assert_eq!(fetches[0].uid, Some(74)); + } + #[test] fn parse_names_w_unilateral() { let lines = b"\