1
1
import { assert , expect } from "chai" ;
2
- import { StdioDeltaChat as DeltaChat , DcEvent } from "../deltachat.js" ;
2
+ import { StdioDeltaChat as DeltaChat , DcEvent , C } from "../deltachat.js" ;
3
3
import { RpcServerHandle , createTempUser , startServer } from "./test_base.js" ;
4
4
5
5
const EVENT_TIMEOUT = 20000 ;
@@ -80,11 +80,8 @@ describe("online tests", function () {
80
80
}
81
81
this . timeout ( 15000 ) ;
82
82
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 ] ;
88
85
const chatId = await dc . rpc . createChatByContactId ( accountId1 , contactId ) ;
89
86
const eventPromise = waitForEvent ( dc , "IncomingMsg" , accountId2 ) ;
90
87
@@ -101,20 +98,18 @@ describe("online tests", function () {
101
98
expect ( messageList ) . have . length ( 1 ) ;
102
99
const message = await dc . rpc . getMessage ( accountId2 , messageList [ 0 ] ) ;
103
100
expect ( message . text ) . equal ( "Hello" ) ;
101
+ expect ( message . showPadlock ) . equal ( true ) ;
104
102
} ) ;
105
103
106
- it ( "send and receive text message roundtrip, encrypted on answer onwards " , async function ( ) {
104
+ it ( "send and receive text message roundtrip" , async function ( ) {
107
105
if ( ! accountsConfigured ) {
108
106
this . skip ( ) ;
109
107
}
110
108
this . timeout ( 10000 ) ;
111
109
112
110
// 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 ] ;
118
113
const chatId = await dc . rpc . createChatByContactId ( accountId1 , contactId ) ;
119
114
const eventPromise = waitForEvent ( dc , "IncomingMsg" , accountId2 ) ;
120
115
dc . rpc . miscSendTextMessage ( accountId1 , chatId , "Hello2" ) ;
0 commit comments