Added function to change read status for chat, updated connect

This commit is contained in:
Adhiraj
2020-09-01 12:13:25 +05:30
parent c5fec0e6a3
commit 218c9bcc18
9 changed files with 222 additions and 111 deletions

View File

@@ -70,7 +70,7 @@ WAConnectionTest('Misc', (conn) => {
const response = await conn.updatePresence(testJid, Presence.composing)
assert.ok(response)
})
it('should mark a chat unread', async () => {
it('should change a chat read status', async () => {
const waitForEvent = new Promise (resolve => {
conn.on ('chat-update', ({jid, count}) => {
if (jid === testJid) {
@@ -80,8 +80,12 @@ WAConnectionTest('Misc', (conn) => {
}
})
})
await conn.sendReadReceipt(testJid, null, -2)
await conn.chatRead (testJid, 'unread')
await waitForEvent
await delay (5000)
await conn.chatRead (testJid, 'read')
})
it('should archive & unarchive', async () => {
await conn.modifyChat (testJid, ChatModification.archive)