From 93d8504950b6a20b04c61aba46dd24671c303e6b Mon Sep 17 00:00:00 2001 From: mdecimus Date: Sat, 23 Dec 2023 08:58:30 +0100 Subject: [PATCH] Updated tests --- crates/store/src/dispatch/store.rs | 6 +++--- tests/src/jmap/delivery.rs | 6 +++--- tests/src/jmap/thread_merge.rs | 29 +++++++++++------------------ 3 files changed, 17 insertions(+), 24 deletions(-) diff --git a/crates/store/src/dispatch/store.rs b/crates/store/src/dispatch/store.rs index 7ecb8da5..9d5b4f25 100644 --- a/crates/store/src/dispatch/store.rs +++ b/crates/store/src/dispatch/store.rs @@ -533,7 +533,7 @@ impl Store { } } - eprintln!( + println!( concat!( ", account {}, collection {},", " family {}, field {}, key {:?}: {:?}" @@ -559,7 +559,7 @@ impl Store { return Ok(true); } SUBSPACE_INDEXES => { - eprintln!( + println!( concat!( "Found index key, account {}, collection {}, ", "document {}, property {}, value {:?}: {:?}" @@ -573,7 +573,7 @@ impl Store { ); } _ => { - eprintln!( + println!( "Found key in {:?}: {:?} {:?}", char::from(subspace), key, diff --git a/tests/src/jmap/delivery.rs b/tests/src/jmap/delivery.rs index 8453d1f1..8d69f85a 100644 --- a/tests/src/jmap/delivery.rs +++ b/tests/src/jmap/delivery.rs @@ -24,7 +24,7 @@ use std::time::Duration; use directory::backend::internal::manage::ManageDirectory; -use jmap::mailbox::{INBOX_ID, TRASH_ID}; +use jmap::mailbox::{INBOX_ID, JUNK_ID}; use jmap_proto::types::{collection::Collection, id::Id, property::Property}; use tokio::{ @@ -137,7 +137,7 @@ pub async fn test(params: &mut JMAPTest) { ); assert_eq!( server - .get_tag(john_id, Collection::Email, Property::MailboxIds, TRASH_ID) + .get_tag(john_id, Collection::Email, Property::MailboxIds, JUNK_ID) .await .unwrap() .map_or(0, |bm| bm.len()), @@ -181,7 +181,7 @@ pub async fn test(params: &mut JMAPTest) { ); assert_eq!( server - .get_tag(john_id, Collection::Email, Property::MailboxIds, TRASH_ID) + .get_tag(john_id, Collection::Email, Property::MailboxIds, JUNK_ID) .await .unwrap() .unwrap() diff --git a/tests/src/jmap/thread_merge.rs b/tests/src/jmap/thread_merge.rs index 67607997..94589afe 100644 --- a/tests/src/jmap/thread_merge.rs +++ b/tests/src/jmap/thread_merge.rs @@ -27,7 +27,7 @@ use crate::{ jmap::{assert_is_empty, mailbox::destroy_all_mailboxes}, store::deflate_test_resource, }; -use jmap::{email::ingest::IngestEmail, IngestError}; +use jmap::{email::ingest::IngestEmail, mailbox::INBOX_ID, IngestError}; use jmap_client::{email, mailbox::Role}; use jmap_proto::types::{collection::Collection, id::Id}; use mail_parser::{mailbox::mbox::MessageIterator, MessageParser}; @@ -229,22 +229,15 @@ async fn test_multi_thread(params: &mut JMAPTest) { println!("Running Email Merge Threads tests (multi-threaded)..."); //let semaphore = sync::Arc::Arc::new(tokio::sync::Semaphore::new(100)); let mut handles = vec![]; - let mailbox_id_str = params - .client - .set_default_account_id(Id::new(0u64).to_string()) - .mailbox_create("Multi-thread nightmare", None::, Role::None) - .await - .unwrap() - .take_id(); - params - .client - .set_default_account_id(Id::new(0u64).to_string()) - .mailbox_create("Other mailbox", None::, Role::None) - .await - .unwrap(); - let mailbox_id = Id::from_bytes(mailbox_id_str.as_bytes()) - .unwrap() - .document_id(); + for num in 0..3 { + params + .client + .set_default_account_id(Id::new(0u64).to_string()) + .mailbox_create(format!("Mailbox {num}"), None::, Role::None) + .await + .unwrap(); + } + for message in MessageIterator::new(Cursor::new(deflate_test_resource("mailbox.gz"))) .collect::>() .into_iter() @@ -262,7 +255,7 @@ async fn test_multi_thread(params: &mut JMAPTest) { message: MessageParser::new().parse(message.contents()), account_id: 0, account_quota: 0, - mailbox_ids: vec![mailbox_id], + mailbox_ids: vec![INBOX_ID], keywords: vec![], received_at: None, skip_duplicates: true,