Skip to content

Commit ab47d6f

Browse files
committed
test: send only encrypted messages in online JS tests
1 parent 07946a1 commit ab47d6f

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

deltachat-jsonrpc/typescript/test/online.ts

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { assert, expect } from "chai";
2-
import { StdioDeltaChat as DeltaChat, DcEvent } from "../deltachat.js";
2+
import { StdioDeltaChat as DeltaChat, DcEvent, C } from "../deltachat.js";
33
import { RpcServerHandle, createTempUser, startServer } from "./test_base.js";
44

55
const EVENT_TIMEOUT = 20000;
@@ -80,11 +80,8 @@ describe("online tests", function () {
8080
}
8181
this.timeout(15000);
8282

83-
const contactId = await dc.rpc.createContact(
84-
accountId1,
85-
account2.email,
86-
null
87-
);
83+
const vcard = await dc.rpc.makeVcard(accountId2, [C.DC_CONTACT_ID_SELF]);
84+
const contactId = (await dc.rpc.importVcardContents(accountId1, vcard))[0];
8885
const chatId = await dc.rpc.createChatByContactId(accountId1, contactId);
8986
const eventPromise = waitForEvent(dc, "IncomingMsg", accountId2);
9087

@@ -101,20 +98,18 @@ describe("online tests", function () {
10198
expect(messageList).have.length(1);
10299
const message = await dc.rpc.getMessage(accountId2, messageList[0]);
103100
expect(message.text).equal("Hello");
101+
expect(message.showPadlock).equal(true);
104102
});
105103

106-
it("send and receive text message roundtrip, encrypted on answer onwards", async function () {
104+
it("send and receive text message roundtrip", async function () {
107105
if (!accountsConfigured) {
108106
this.skip();
109107
}
110108
this.timeout(10000);
111109

112110
// send message from A to B
113-
const contactId = await dc.rpc.createContact(
114-
accountId1,
115-
account2.email,
116-
null
117-
);
111+
const vcard = await dc.rpc.makeVcard(accountId2, [C.DC_CONTACT_ID_SELF]);
112+
const contactId = (await dc.rpc.importVcardContents(accountId1, vcard))[0];
118113
const chatId = await dc.rpc.createChatByContactId(accountId1, contactId);
119114
const eventPromise = waitForEvent(dc, "IncomingMsg", accountId2);
120115
dc.rpc.miscSendTextMessage(accountId1, chatId, "Hello2");

0 commit comments

Comments
 (0)