mirror of
https://github.com/chatmail/core.git
synced 2026-05-13 11:56:30 +03:00
fix formatting
make test pass fix clippy
This commit is contained in:
@@ -18,7 +18,7 @@ pub use deltachat::accounts::Accounts;
|
|||||||
pub mod events;
|
pub mod events;
|
||||||
pub mod types;
|
pub mod types;
|
||||||
|
|
||||||
use crate::api::types::chat_list::{ChatListItemFetchResult, get_chat_list_item_by_id};
|
use crate::api::types::chat_list::{get_chat_list_item_by_id, ChatListItemFetchResult};
|
||||||
|
|
||||||
use types::account::Account;
|
use types::account::Account;
|
||||||
use types::chat::FullChat;
|
use types::chat::FullChat;
|
||||||
@@ -435,7 +435,7 @@ impl CommandApi {
|
|||||||
query: Option<String>,
|
query: Option<String>,
|
||||||
) -> Result<Vec<u32>> {
|
) -> Result<Vec<u32>> {
|
||||||
let ctx = self.get_context(account_id).await?;
|
let ctx = self.get_context(account_id).await?;
|
||||||
let contacts = Contact::get_all(&ctx, list_flags, query).await?;
|
let contacts = Contact::get_all(&ctx, list_flags, query.as_deref()).await?;
|
||||||
Ok(contacts.into_iter().map(|c| c.to_u32()).collect())
|
Ok(contacts.into_iter().map(|c| c.to_u32()).collect())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -448,7 +448,7 @@ impl CommandApi {
|
|||||||
query: Option<String>,
|
query: Option<String>,
|
||||||
) -> Result<Vec<ContactObject>> {
|
) -> Result<Vec<ContactObject>> {
|
||||||
let ctx = self.get_context(account_id).await?;
|
let ctx = self.get_context(account_id).await?;
|
||||||
let contact_ids = Contact::get_all(&ctx, list_flags, query).await?;
|
let contact_ids = Contact::get_all(&ctx, list_flags, query.as_deref()).await?;
|
||||||
let mut contacts: Vec<ContactObject> = Vec::with_capacity(contact_ids.len());
|
let mut contacts: Vec<ContactObject> = Vec::with_capacity(contact_ids.len());
|
||||||
for id in contact_ids {
|
for id in contact_ids {
|
||||||
contacts.push(
|
contacts.push(
|
||||||
|
|||||||
@@ -38,6 +38,10 @@ describe("online tests", function () {
|
|||||||
url: "ws://localhost:" + CMD_API_SERVER_PORT + "/ws",
|
url: "ws://localhost:" + CMD_API_SERVER_PORT + "/ws",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
dc.on("ALL", ({ name, contextId }) => {
|
||||||
|
if (name !== "INFO") console.log(contextId, name);
|
||||||
|
});
|
||||||
|
|
||||||
account = await createTempUser(process.env.DCC_NEW_TMP_EMAIL);
|
account = await createTempUser(process.env.DCC_NEW_TMP_EMAIL);
|
||||||
if (!account || !account.email || !account.password) {
|
if (!account || !account.email || !account.password) {
|
||||||
console.log(
|
console.log(
|
||||||
@@ -92,7 +96,11 @@ describe("online tests", function () {
|
|||||||
null
|
null
|
||||||
);
|
);
|
||||||
const chatId = await dc.rpc.contactsCreateChatByContactId(acc1, contactId);
|
const chatId = await dc.rpc.contactsCreateChatByContactId(acc1, contactId);
|
||||||
const eventPromise = waitForEvent(dc, "INCOMING_MSG", acc2);
|
const eventPromise = Promise.race([
|
||||||
|
waitForEvent(dc, "MSGS_CHANGED", acc2),
|
||||||
|
waitForEvent(dc, "INCOMING_MSG", acc2),
|
||||||
|
]);
|
||||||
|
|
||||||
dc.rpc.miscSendTextMessage(acc1, "Hello", chatId);
|
dc.rpc.miscSendTextMessage(acc1, "Hello", chatId);
|
||||||
const { field1: chatIdOnAccountB } = await eventPromise;
|
const { field1: chatIdOnAccountB } = await eventPromise;
|
||||||
await dc.rpc.acceptChat(acc2, chatIdOnAccountB);
|
await dc.rpc.acceptChat(acc2, chatIdOnAccountB);
|
||||||
@@ -111,7 +119,7 @@ describe("online tests", function () {
|
|||||||
if (!are_configured) {
|
if (!are_configured) {
|
||||||
this.skip();
|
this.skip();
|
||||||
}
|
}
|
||||||
this.timeout(7000);
|
this.timeout(10000);
|
||||||
|
|
||||||
// send message from A to B
|
// send message from A to B
|
||||||
const contactId = await dc.rpc.contactsCreateContact(
|
const contactId = await dc.rpc.contactsCreateContact(
|
||||||
@@ -120,9 +128,15 @@ describe("online tests", function () {
|
|||||||
null
|
null
|
||||||
);
|
);
|
||||||
const chatId = await dc.rpc.contactsCreateChatByContactId(acc1, contactId);
|
const chatId = await dc.rpc.contactsCreateChatByContactId(acc1, contactId);
|
||||||
|
const eventPromise = Promise.race([
|
||||||
|
waitForEvent(dc, "MSGS_CHANGED", acc2),
|
||||||
|
waitForEvent(dc, "INCOMING_MSG", acc2),
|
||||||
|
]);
|
||||||
dc.rpc.miscSendTextMessage(acc1, "Hello2", chatId);
|
dc.rpc.miscSendTextMessage(acc1, "Hello2", chatId);
|
||||||
// wait for message from A
|
// wait for message from A
|
||||||
const event = await waitForEvent(dc, "INCOMING_MSG", acc2);
|
console.log("wait for message from A");
|
||||||
|
|
||||||
|
const event = await eventPromise;
|
||||||
const { field1: chatIdOnAccountB } = event;
|
const { field1: chatIdOnAccountB } = event;
|
||||||
|
|
||||||
await dc.rpc.acceptChat(acc2, chatIdOnAccountB);
|
await dc.rpc.acceptChat(acc2, chatIdOnAccountB);
|
||||||
@@ -137,9 +151,13 @@ describe("online tests", function () {
|
|||||||
);
|
);
|
||||||
expect(message.text).equal("Hello2");
|
expect(message.text).equal("Hello2");
|
||||||
// Send message back from B to A
|
// Send message back from B to A
|
||||||
|
const eventPromise2 = Promise.race([
|
||||||
|
waitForEvent(dc, "MSGS_CHANGED", acc1),
|
||||||
|
waitForEvent(dc, "INCOMING_MSG", acc1),
|
||||||
|
]);
|
||||||
dc.rpc.miscSendTextMessage(acc2, "super secret message", chatId);
|
dc.rpc.miscSendTextMessage(acc2, "super secret message", chatId);
|
||||||
// Check if answer arives at A and if it is encrypted
|
// Check if answer arives at A and if it is encrypted
|
||||||
await waitForEvent(dc, "INCOMING_MSG", acc1);
|
await eventPromise2;
|
||||||
|
|
||||||
const messageId = (
|
const messageId = (
|
||||||
await dc.rpc.messageListGetMessageIds(acc1, chatId, 0)
|
await dc.rpc.messageListGetMessageIds(acc1, chatId, 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user